Re: Equivalent of Linux timezone in FreeBSD

From: Warner Losh <imp_at_bsdimp.com>
Date: Thu, 27 Oct 2022 19:32:55 UTC
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
>
>