Is there a platform independent (Windows or UNIX) way to get UTC/GMT time? This:
- Code: Select all
DateAndTime now asUTC
doesn't seem to work. It answers
, which is an hour fast. I'm here in New Jersey (USA) and we are on Daylight Savings Time. Normally we are -5 hours from GMT but for the summer (on March 13th) we went to -4 hours.2011-03-25T22:30:37.071+00:00
"DateAndTime now" gets its values from Date and Time, which get there values from the VM via primitives. The primitives seem to answer the local machine time then "DateAndTime now asUTC" adjusts it to UTC but does it wrong because it doesn't take into account the summer time offset.
Is there a VM primitive that answers UTC time? If not, can we please have one? Maybe one that answers a DateAndTime or DateAndTime milliseconds or microseconds.
I know how to get UTC time from Windows but would like my code to work for both Windows and UNIX (and friends). This seems like a good candidate for the VM. Aren't there different VMs for different platforms? Couldn't each VM do what it needs to do to answer UTC time for the same primitive?
Is there a platform function that works for both Windows and UNIX (I know that doesn't make sense as a platform function but maybe it is wrapped well enough to hide the platform part). Or something like a DLL that works on both platforms.
Lou