From nobody Fri Oct 28 21:56:19 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 4MzbwX1Zsfz4g133 for ; Fri, 28 Oct 2022 21:56:28 +0000 (UTC) (envelope-from montgomerysmithstephen@gmail.com) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 4MzbwW2Gyzz3Mjk for ; Fri, 28 Oct 2022 21:56:27 +0000 (UTC) (envelope-from montgomerysmithstephen@gmail.com) Received: by mail-io1-xd32.google.com with SMTP id z3so5728098iof.3 for ; Fri, 28 Oct 2022 14:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=s76z5n+sfXGxoJOX3fMO3oIh6Z7kDldKT23cyTm+u8A=; b=JFTQjXV63eBbPsaYkA0slOO0Esja5+sBn3p2BNPv3bUdGnkzFdulDOrK3UQfgGGbdr zst7hg7nEELlvDxRO2FJdXpp+wLA/7nB/gYWvn6uxze1e25s8np/NLZ1GelML7f5CqKh FItOmhDK1yk8TfN09qyU6mOs0wP/rQ6NPSGaEpM4gw8sv8I92aXA8P16XkmN+BTJ+rO/ yKp5BX8IVj4Vh0Um2LjENeEOOpqbyAufueiNENm4utxDWNaVxi8JDm3Z3cXt9M7gcxDI 7xff/cHrfVog+qCpjuOFtIYXFqH7F8ZmyOFXzqgOwVJa9eQ48mCMFmIIxcY2RSIfvK5v urzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s76z5n+sfXGxoJOX3fMO3oIh6Z7kDldKT23cyTm+u8A=; b=YRcpQSNJM1w2MCodpc+EwULY1IrhZDAV4Ky+yaTTRSAwZTxrHgTpZds9plekbEtDhC Ga45qehVHwSlyG+8NGhP0uqE0/4X+nQoU37MK/81ahamHWFzaQIFVD/HKHf+9aPAEAZZ 0jSQ60V41IlTYvLaHwJlH8X76A3kWbxKLPWcK9qjYtAh+iOrE5hT8xqIbNZttDKXZlRK ZQY5VMVgNTyMRzlrVm+47NyZsx+UKMZvcrQpLTKauB24ieN0CbRCouQP9d+ry/dMAzQk LgwB1KOjB26xBU06vPHz8IiDV4Z84aECIXoYLfu9kdwxYm4U1D3lgkc3WwTHjYX+nQyh 6NQw== X-Gm-Message-State: ACrzQf3MH1suOEwaTJUa9fI+TasfBZPHM577cHgjGcJmrOu45BGxv08c tKq/hAei8e1kFGtc3FPuyMw= X-Google-Smtp-Source: AMsMyM69mRVSsIfu6F0sXOxgyvTOAOuzRmoNxrXlMfxo0GYWy5qx4dLlPqLzMCR0mukNuYbsghuH5w== X-Received: by 2002:a02:c00e:0:b0:373:5326:e14f with SMTP id y14-20020a02c00e000000b003735326e14fmr845491jai.168.1666994186461; Fri, 28 Oct 2022 14:56:26 -0700 (PDT) Received: from [10.8.4.34] ([161.130.189.159]) by smtp.gmail.com with ESMTPSA id d2-20020a023f02000000b0035678e2e175sm2111746jaa.50.2022.10.28.14.56.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 14:56:26 -0700 (PDT) From: Stephen Montgomery-Smith X-Google-Original-From: Stephen Montgomery-Smith Message-ID: Date: Fri, 28 Oct 2022 16:56:19 -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 Content-Language: en-US To: Thomas Mueller , Warner Losh Cc: freebsd-hackers References: <20221028075511.554f12c8@tmu.ulm.sysgo.com> <6610316d-7ebf-f914-4276-3add9fd74dea@FreeBSD.org> In-Reply-To: <6610316d-7ebf-f914-4276-3add9fd74dea@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4MzbwW2Gyzz3Mjk X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=JFTQjXV6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of montgomerysmithstephen@gmail.com designates 2607:f8b0:4864:20::d32 as permitted sender) smtp.mailfrom=montgomerysmithstephen@gmail.com X-Spamd-Result: default: False [-3.93 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.996]; NEURAL_HAM_SHORT(-0.94)[-0.939]; 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::d32: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 16:34, Stephen Montgomery-Smith wrote: > 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. Oops, I meant localtime(&zero)->tm_gmtoff, where zero is of type time_t.