Re: Issues subtracting Unix epoch from date
Re: Issues subtracting Unix epoch from date
- Subject: Re: Issues subtracting Unix epoch from date
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 20 Feb 2010 15:18:06 -0500
On Sat, Feb 20, 2010 at 3:10 PM, Nathan Vander Wilt
<email@hidden> wrote:
> I was assuming that AppleScript treated dates internally like Cocoa does: as
> seconds from a reference date. But I'm getting the impression that within an
> AppleScript script itself, dates are stored (and *calculated*!) internally
> just as the class is writable externally: four numbers YMD+S and some
> elementary calendar assumptions. (Thanks Shane for corroborating on this.)
The internal representation used by Applescript has nothing to do with
this, really. I mean, UNIX uses a count of non-leap seconds since Jan
1, 1970 at midnight GMT, but it still honors daylight saving time
rules in effect at the target time (not just the present) when asked
to convert to local time. All that matters is the interface to the
system - you are specifying a date using year, month, day, hour,
minute, and second, no matter what AppleScript turns that into before
manipulating it.
Your bug came about due to daylight saving time, and if you're using
local time at all, you can't really avoid dealing with DST issues. For
instance, in the US, does 2AM on the day we "fall back" correspond to
7200 or 10,800 seconds after midnight? Well, both; without specifying
a time zone to indicate which 2am you mean, there's no way to choose
between them.
The fact that "time to GMT" doesn't change while the script is
running, even if it runs across the DST switch (which I've just
verified) is a bug, IMO.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden