[Pythonmac-SIG] Apple Events
John W Baxter
jwblist@olympus.net
Fri, 14 Apr 2000 15:17:54 -0700
Dan Green enquires:
>Does anybody know how to convert apple event types of "ldt" to a proper date
>value? Whenever I capture said value in a python script I get a value of
>
>Unknown('ltd', '\000\000\000\000\265\034\246\343') or something similar.
>
>Dates on a Mac should be # of seconds since 1980 sometime, no?
>
>--
>Dan Green | "So What? It's your problem to learn to live with,
'ldt ' (note the trailing space) is the type used by AppleScript (and
probably others) for the Macintosh long date type, which is a 64-bit signed
number of seconds since the midnight at the beginning of January 1, 1904.
It can be easily represented in C in one of the ways the Apple headers do
it: an unsigned long low longword and a signed long high longword.
Sorry, but I haven't tried dealing with it in Python...I suppose a C
extension could fabricate a suitable Python long integer.
Hint: in the range 1904 through early 2040, the high four bytes are
zero...after sometime in 1972, the low four bytes are a negative number
when considered as signed (which the Mac headers tend to do for the old 4
byte date type given the Pascal heritage).
--John (sending just to the list, after having accidentally sent just to
Mr Green)
--
John Baxter jwblist@olympus.net Port Ludlow, WA, USA