[erlang-questions] Time zone

Chandru <>
Tue Dec 12 10:44:53 CET 2006


On 12/12/06, Bruce Fitzsimons <> wrote:
> Chandru wrote:
> > Hi,
> >
> > Is there a way to get the time zone configured on a machine without
> > resorting to hacks.
> >
> > It'll be nice to have something like:
> >
> > calendar:time_zone().
> > OR
> > erlang:system_info(time_zone).
> >
> >
> I'm not sure what you would expect as a response? TZ strings are complex
> beasties and there are at least 4 forms -- e.g. GMT, GMT-12/x/x/x...,
> :file and Europe/Paris. man tzset or man timezone.
>
> You may be asking about finding out your offset from GMT or UTC, but
> that is quite a different question. The reason this isn't done once in
> yaws is because of daylight savings...the offset changes under your feet
> and you're not allowed to know when.

Basically offset from GMT was what I was after. I'm writing a web
server and I had to print out access logs in the Common Log Format.

I wasn't trying to poke fun at the code in yaws. I had done it exactly
the same way myself and then thought I'll try and look in Yaws to see
if there was a more elegant way :-) Looks like there isn't one readily
available.

cheers
Chandru



More information about the erlang-questions mailing list