From nobody Thu Oct 27 19:32:55 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 4Mywnd5ydYz4fsyT for ; Thu, 27 Oct 2022 19:33:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 4Mywnc3Zmfz3FST for ; Thu, 27 Oct 2022 19:33:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ej1-x629.google.com with SMTP id sc25so7531723ejc.12 for ; Thu, 27 Oct 2022 12:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nDGirRBdfgEkN04vPSI29LhaEhgLbUjsOBU2VTx8lFc=; b=BwwAauuhaMZYc8/bWDnFfJdHAi2APSG9MqTMlRf5W//m+iN8lOalIpjj74fmD7AfGr UhdcnDheq9kS9T8km6NuwPpFCtjVae6SZ7Bvjml2gV5BwSyTMbR3ie+TrxhPP/hzrBP+ HaXpOrZ79G0WeL/DLc4AEmJpNV1xQpnPG9BAJN0vHQosEZjIYY6BtvYYyfkEO6/jESXj t0JjZ+Se57tE+PdCthsOye/Wx2NATS32tXgUaqgl9xhBeEISWt8V7pIjf1m1ugDWuRDa Pj72CwgWR1mic1YNW2ayPu1m8PxnqKeSWXuNjB0Utu5XNv65BmTzR1H+Cu5SCVIdblWt vqWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nDGirRBdfgEkN04vPSI29LhaEhgLbUjsOBU2VTx8lFc=; b=WrYESziMhDkJkVbTUTcgs9d3fg/0FPs7T8Nh6j9G2YL6BomLpe5Q98bAGLt2nK4ZPw RRd73qYnXkMyq/bM5rEi1ZaUdmLE+vGacX9U4aeLjRrVyrf2vqb8/kVJD9uWyo59HQcz UsAD5Yg+5aA2PdHZJ8mitSGaGn0aJbIg2xhQHg/juHszei71+Q/E9vBc73UUdPiO2yJl llHPwaT7UM9m02PKBpy91A0eslRpknE2y7EM1p0HA67o4TGI/cR4OnRbojyV4W4veuV9 0Pqu//i1/PcuFIfSH+SuQsoPyd/OYE75ZlWxplGJULaI3QXIYrOklzFHx9jHTx9vgLaq ovBg== X-Gm-Message-State: ACrzQf1VrEXve0YOj0onyhsYhVDZj3tu7gVLFCCJDeUgZNkJco592IK6 +NpBNVIdHeEiaGNtgwj+jAS5ovEV3FVKCxJTTw1U2UEuie8= X-Google-Smtp-Source: AMsMyM6lEokFMKOyUqTz8jCUGazt+UhYm4Kr11dCysIKbG1TvUbfmTZYoZVocP4qog1e2Ex5caL5E9Oo/eNx4IQhHMw= X-Received: by 2002:a17:907:2710:b0:7ad:86f9:9bad with SMTP id w16-20020a170907271000b007ad86f99badmr6305008ejk.32.1666899187079; Thu, 27 Oct 2022 12:33:07 -0700 (PDT) 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 References: In-Reply-To: From: Warner Losh Date: Thu, 27 Oct 2022 13:32:55 -0600 Message-ID: Subject: Re: Equivalent of Linux timezone in FreeBSD To: Stephen Montgomery-Smith Cc: freebsd-hackers Content-Type: multipart/alternative; boundary="000000000000ec342605ec093583" X-Rspamd-Queue-Id: 4Mywnc3Zmfz3FST X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=BwwAauuh; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2a00:1450:4864:20::629) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FREEMAIL_TO(0.00)[gmail.com]; R_SPF_NA(0.00)[no SPF record]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; FROM_HAS_DN(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::629:from]; DMARC_NA(0.00)[bsdimp.com]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com] X-ThisMailContainsUnwantedMimeParts: N --000000000000ec342605ec093583 Content-Type: text/plain; charset="UTF-8" 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. > Except it's not completely reliable on linux, since it's not a constant except for the few minutes around the current time.... You can't expect it to work around the cut-overs of daylight savings time, for example. > Is there an equivalent of this in FreeBSD or other BSDs? > getenv("TZ") will get the timezone for the current process. But what are you using this value for? Warner > Is this the right group to ask this question? > > Thanks, Stephen > > --000000000000ec342605ec093583 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Oct 27, 2022 at 1:26 PM Steph= en 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.

Except it's not completely reliable on linux, since it's not= a constant except for
the few minutes around the current time...= . You can't expect it to work around the
cut-overs of dayligh= t savings time, for example.
=C2=A0
Is there an equivalent of this in FreeBSD or other BSDs?

getenv("TZ") will get the timezone for the curr= ent process.

But what are you using this value for= ?

Warner
=C2=A0
Is this the right group to ask this question?

Thanks, Stephen

--000000000000ec342605ec093583--