The seconds and time zones

Richard Gaskin ambassador at fourthworld.com
Tue Jan 26 10:18:42 EST 2010


Jacques Hausser (who is not Jacque) wrote:

 > But I can nevertheless say that I did set my computer (Mac OS X)
 > to different time zones and the seconds didn't change accordingly...
 > they seem trustable within a computer.

The engine's internal clock is initialized when the engine starts up, so 
if you quit before you change your time zone the seconds will be 
reliable for comparisons across time zones.

Here's a quick test I just did to verify this:

At 7:01AM PST I got these values:
   Seconds: 1264518037
   Internet Date: Tue, 26 Jan 2010 07:01:02 -0800

Then I quit Rev, opened my System Control Panel, changed my location to 
Brisbane AU, restarted Rev, and got these:
   Seconds: 1264518145
   Internet Date:  Wed, 27 Jan 2010 01:02:09 +1000

While the difference in global time is several hours, the difference in 
the seconds is merely 108, roughly the amount of time I spent quitting 
and changing my system's location.

FWIW, I also tried this without quitting Rev in between, and apparently 
it does not update the time zone until you restart.

So it appears the seconds are indeed useful for comparing times and 
dates across time zones, provided the time zone does not change while 
the engine is running.

Personally, I prefer the Internet date format because it's 
human-readable.  It also works at the same level of granularity 
(seconds) but carries the additional benefit of storing the time zone it 
was acquired in.

The latter may not be useful for many apps, but I have one case where I 
need to know where people are in addition to when they perform a given 
action, and having the GMT offset embedded in the string helps me narrow 
that down.


There is an unfortunate implication with this:  because the engine needs 
to be restarted to update the GMT offset of its internal clock, this 
means that automatic changes to time zones like moving from PST to PDT 
will be ignored by the engine.

Anyone know if there's an RQCC request for that?

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list