Re: Very strange dates - BUG
Re: Very strange dates - BUG
- Subject: Re: Very strange dates - BUG
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 30 Jan 2003 09:29:30 -0800
On 1/29/03 10:29 AM, "Michelle Steiner" <email@hidden> wrote:
>
On Wednesday, January 29, 2003, at 10:40 AM, Paul Berkowitz wrote:
>
>
> set thedate to date "1/1/1971"
>
> set thedate to thedate + (-1)
>
> -->date "Monday, November 24, 1834 5:31:43 PM"
>
>
To further complicate this,
>
>
set thedate to thedate - 1
>
-->date "Wednesday, January 19, 1972 3:14:06 AM"
That doesn't exactly complicate it. This was precisely what I did in the
workaround I provided for (time to GMT):
>
Since subtracting positive integers works OK for all dates (at least after
>
1/1/1904), this is the workaround:
>
>
>
set timeToGMT to (time to GMT)
>
if timeToGMT < 0 then
>
set theDate to theDate - (-timeToGMT)
>
else
>
set theDate to theDate + (timeToGMT)
>
end if
>
>
>
Shouldn't AppleScript be able to do the same thing? Convert addition of a
>
signed negative integer to subtraction of an unsigned integer (or signed
>
positive integer, if that's what it's doing)?
Subtracting (or adding) unsigned integers is evidently a different matter
from adding (or subtracting) signed integers (integers with a + or - sign).
There are actually twice as many Unsigned integers as each type of signed
integer. I think that Apple time, based on seconds, must actually use signed
integers which "roll up" after they "roll down". In fact, that date I found
in January 1971 is approximately, but not exactly half way between between
the "dawn of time" - Jan 1, 1904 - and the "end of time" - Feb 5(?) 2040. I
wonder what accounts for the discrepancy.
>
>
So, what is the difference between + (-1) and - 1?
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.