• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Issues subtracting Unix epoch from date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Issues subtracting Unix epoch from date
      • From: Nathan Vander Wilt <email@hidden>
References: 
 >Issues subtracting Unix epoch from date (From: Nathan Vander Wilt <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: "Mark J. Reed" <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: Nathan Vander Wilt <email@hidden>)

  • Prev by Date: Re: Issues subtracting Unix epoch from date
  • Next by Date: Re: Issues subtracting Unix epoch from date
  • Previous by thread: Re: Issues subtracting Unix epoch from date
  • Next by thread: Re: Issues subtracting Unix epoch from date
  • Index(es):
    • Date
    • Thread