Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Playing with time (or, a lament to POSIX::strftime's %Z)

by seattlejohn (Deacon)
on Dec 24, 2002 at 00:53 UTC ( #222003=note: print w/replies, xml ) Need Help??

in reply to Playing with time (or, a lament to POSIX::strftime's %Z)

As waswas-fng explains, this problem is much harder than it first appears. To the best of my knowledge, there is no strictly algorithmic way to compute the local time correctly for any arbitrary place on earth. In some countries, e.g. Israel, the start and end dates of daylight savings time are not directly computable, because they are decided upon each year by some sort of panel (though I suppose you could watch for their announcements and update your lookup tables). In other cases locations that do have "rules" for daylight savings time bend those rules because of special events.

That's on top of the fact that individual countries may begin and end daylight savings time at different points in the year (and don't forget that summer and winter in the southern hemisphere are opposite what they are in the northern)... and begin and end dst at different times during the night (e.g. 1am vs. 2am). Oh, and there are some really arcane rules within countries as well. In the U.S. for example, Hawaii and Arizona don't observe dst, except for the portion of Arizona that is part of the Navajo reservation, which does. In Indiana, different counties are in different times zones; some observe dst, and some don't. There's some underlying logic to it, but without knowing precisely where a user is located relative to a basically arbitrary line on a map, you're going to have a tough time working it all out!

(And in the way-OT department, here's my personal rant about time, since you asked: the Washington State Ferry schedule reads, "Noon is noted as 12:00 a.m. and one minute past noon as 12:01 p.m.; midnight is noted as 12:00 p.m. and one past midnight as 12:01 a.m." Isn't the opposite the way virtually everyone else in the world handles noon and midnight?)

        $perlmonks{seattlejohn} = 'John Clyman';

  • Comment on Re: Playing with time (or, a lament to POSIX::strftime's %Z)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://222003]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2023-02-04 21:21 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (31 votes). Check out past polls.