Re: Broken date math on AppleScript 2.0
Re: Broken date math on AppleScript 2.0
- Subject: Re: Broken date math on AppleScript 2.0
- From: Doug McNutt <email@hidden>
- Date: Tue, 19 Feb 2008 19:08:06 -0700
At 17:27 -0500 2/19/08, deivy petrescu wrote:
>I do the computation in Days, AS does it in seconds...
On this OS 9 box I get - in MPW
date -n --> 3286291856
which is the seconds count starting at the beginning of CY 1904. Note that the number for today is bigger than 2^29 and in fact is negative if treated as a 32 bit signed integer.
With OS neXt we have a base epoch at the start of 1970 which probably helps and we also have some new epoch dating that is likely to be based on 64 bit integers. I haven't studied that.
But in either case an integer limit of 2^29 -x is never going to be good enough for calculations in seconds.
Microsoft, every once in a while, does something right. Excel dates are all 64 bit floating point values expressed in days from the epoch, 1904 for the Mac and 1900 for the peecee (with a known error because 1900 is treated as a leap year). The nice thing is that one can go from paleolithic to eternal with the gentle loss in precision that is a part of floating point. It's easy to understand.
Can we have a description of just what AppleScript does? Preferably a simple description of a simple task. What are the time codes placed on disk files these days? Does it matter what file system is in use? Are they UT or local time? How many bits are used? Obfuscating the details to support English-like coding with definitions of minutes, hours, weeks and the like doesn't help much.
The year of the dog is gone. We're now in the year of the rat, I think.
--
--> Life begins at ovulation. Ladies should endeavor to get every young life fertilized. <--
_______________________________________________
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