From nobody Fri Oct 28 21:34:36 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MzbRM3v7Tz4fxPl for ; Fri, 28 Oct 2022 21:34:39 +0000 (UTC) (envelope-from montgomerysmithstephen@gmail.com) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MzbRL5pG5z3J1m for ; Fri, 28 Oct 2022 21:34:38 +0000 (UTC) (envelope-from montgomerysmithstephen@gmail.com) Received: by mail-il1-x12a.google.com with SMTP id h18so3619186ilq.9 for ; Fri, 28 Oct 2022 14:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=EK3XzMftu/03oMqtlm3CQCx+TAm5Nf9st+jCkSIlfNg=; b=SxnpGBT2ICnjYCmKrEhXLt53rFcTnBTa5lHPJRx12KR3LQI+ZTo/m8dMMuZ3kHoncJ csxl7D41xd66/93NxR3j+FUJJLeyHhZLoCdiw69RcvlgJwSDrmD67qrquVkfNvRxnVBK i6E6/fzas72DCqlV6hsTSzar0GfJ/JkRlKqDVjAyg1TGXWFsK7gp+WJ380FJpbQARTb3 b6pX3lajOI5w1sBG3ulXqIYa3PS032vy9T79upKkMG/EOBOwv9upZCQXJ6SHjY96fwek y3jdYvgcP/iaE0Hd45N2GllpPFkPEsIF0VehqZANvIpMbRtLFEK7q0ijKnGE248eIwR3 JTfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EK3XzMftu/03oMqtlm3CQCx+TAm5Nf9st+jCkSIlfNg=; b=QLLdQ3L/w9E/pj8BPzy30Rqg4k7+JHsooeR0IP+/jHsM8H8pubpr5Uu14WsjH/IUDb VJ8qVSz1ot2fd7v1COmzUf6kR2pMkV/bKoZ8XcvK0GNaJ+VyK5TupWtcKB5FeZC8FSon 0UFs//zsNImI5MDjBnp9ARD3ogKNii1G+Yxk4lBTMEzCPfFVR9esHcu/3NyXIWSIpoZw oIzN2D9h+pL3gMQN9LMYYIqrzHI18tJk0zF3iQUKbxnPXo0exMvo/WIkXMdGX/FrmC3O dK3RrMC3eLwsni/nh7TcK81ADoy0GsAq/CXuaFyPx5b2UkqwK+UTMPyem9PQFeeLxJ81 1SgA== X-Gm-Message-State: ACrzQf3jU3cL0qxLI1Fm4+aShdbgzONJWBhcPDIWqze+iUnzS+2Ccp6S keRx38z8UWvOQNNg7P/qcyuNFkZ8lWM= X-Google-Smtp-Source: AMsMyM7z/eg0hTGbat9YV7WHU1sw+fxM0emU9WAhKMJoiSCo11yr1ea0w483KXKjD01mErvbPF+3rQ== X-Received: by 2002:a05:6e02:d04:b0:300:8716:e7b1 with SMTP id g4-20020a056e020d0400b003008716e7b1mr701911ilj.231.1666992878072; Fri, 28 Oct 2022 14:34:38 -0700 (PDT) Received: from [10.8.4.34] ([161.130.189.159]) by smtp.gmail.com with ESMTPSA id c24-20020a023f58000000b0035a274c8030sm2153647jaf.44.2022.10.28.14.34.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 14:34:37 -0700 (PDT) From: Stephen Montgomery-Smith X-Google-Original-From: Stephen Montgomery-Smith Message-ID: <6610316d-7ebf-f914-4276-3add9fd74dea@FreeBSD.org> Date: Fri, 28 Oct 2022 16:34:36 -0500 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Equivalent of Linux timezone in FreeBSD To: Thomas Mueller , Warner Losh Cc: freebsd-hackers References: <20221028075511.554f12c8@tmu.ulm.sysgo.com> Content-Language: en-US In-Reply-To: <20221028075511.554f12c8@tmu.ulm.sysgo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4MzbRL5pG5z3J1m X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=SxnpGBT2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of montgomerysmithstephen@gmail.com designates 2607:f8b0:4864:20::12a as permitted sender) smtp.mailfrom=montgomerysmithstephen@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.997]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::12a:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_DN_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N On 10/28/22 00:55, Thomas Mueller wrote: > On Thu, 27 Oct 2022 13:32:55 -0600, Warner Losh wrote: >> On Thu, Oct 27, 2022 at 1:26 PM Stephen Montgomery-Smith < >> montgomerysmithstephen@gmail.com> wrote: >> >>> I am attempting to port code that uses an external variable called >>> timezone, which is defined in the Linux file time.h as the number of >>> seconds West of UTC for the current timezone. >>> >> > > The timezone variable is part of the POSIX XSI option (X/Open System > Interfaces). As mentioned in the original post it contains the number > of seconds West of UTC for the current timezone. > > Excerpt from the standard text for tzset(): > #include > [XSI] extern int daylight; > extern long timezone; > [CX] extern char *tzname[2]; > void tzset(void); > [...] > [XSI] The tzset() function also shall set the external variable > daylight to 0 if Daylight Savings Time conversions should never be > applied for the timezone in use; otherwise, non-zero. The external > variable timezone shall be set to the difference, in seconds, between > Coordinated Universal Time (UTC) and local standard time. > > I suppose FreeBSD's tm_gmtoff field in "struct tm" is an equivalent. > Excellent. I replaced timezone with localtime(0)->tm_gmtoff. Thank you very much.