Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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';


In reply to Re: Playing with time (or, a lament to POSIX::strftime's %Z) by seattlejohn
in thread Playing with time (or, a lament to POSIX::strftime's %Z) by baphomet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-20 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found