[erlang-questions] Time zone

Chandru chandrashekhar.mullaparthi@REDACTED
Thu Dec 14 10:31:47 CET 2006


On 13/12/06, Scott Lystig Fritchie <fritchie@REDACTED> wrote:
> >>>>> "cm" == Chandru  <chandrashekhar.mullaparthi@REDACTED> writes:
>
> cm> Basically offset from GMT was what I was after. I'm writing a web
> cm> server and I had to print out access logs in the Common Log
> cm> Format.
>
> Hrm.  I don't know how well this would work on a Windows box, but this
> off-the-top-of-my-head-may-not-compile-cleanly code could be the Hack
> Behind Door #2?  Using a real "port" would avoid repeated fork() and
> exec() overhead.  Incorrectness, for some fraction of a second, may or
> may not bother your app.
>
> Come to think of it, if both fork+exec overhead and the Yaws version's
> repeated arithmetic overhead are too high ... the current_offset()
> func below could use the Yaws method instead of os:cmd/1.  I haven't
> measured how frequently the Yaws version needs to be called in order
> to break even.  :-)

Yaws updates it's timezone calculation every 3 seconds which is
alright I guess. Not a lot of overhead really. You might have a slight
discrepancy in the timestamp received in the 3 seconds during which
daylight saving would've kicked in, but that is ok.

> Though, if you're seriously trying to optimize your Yaws app, timezone
> calculations are probably very low on the list of inefficiencies to
> attack first....

I wasn't trying to optimise yaws. The application I am working on only
has to handle some GET/POST requests and Yaws is a bit too big for
this kind of thing.

I only used Yaws as a reference to see how the offset from UTC was
being calculated.

cheers
Chandru



More information about the erlang-questions mailing list