Does anybody have a scheme for converting Panorama’s Superdate to UTC? I have a database of timestamped entries that on some occasions needs to supply them in a UTC format.
I don’t think this is exactly possible. To convert a Superdate to UTC, you would have to know what time zone the Superdate was in. Also, to make it extra complicated, you would have to make adjustments for Daylight saving time, which of course will be different for different locations.
You mention UTC format, however, in doing some google research just now I could not find any particular standard for formatting UTC times. Perhaps I just missed it.
I believe YYYY-MM-DDTHH:MM:SSZ is a standard format for UTC dates.
Thanks Dave, I can handle that. You must have outGoogled both of us.
OSX, with one’s date/time preferences set properly, converts UTC time values to local ones including whether or not it’s presently DST. I presume the currently set system time zone & daylight savings time offset is available to applications somehow, but I don’t see how to access it from PanoramaX. It might be that system time zone and daylight savings offsets are stored separately Info function(s) analogous to countrycode could provide that information either separately or combined into a ‘here and now’ offset, so a PanX program could localize known UTC values into local ones. One could even check to see if the settings have changed and recalculate the localizations automatically. Without the ability to access the system settings only hard coded localizations are possible.
I don’t see that the superdate concept has to consider time zones and suspect its calculations are all in standard time with no adjustments for DST. For most purposes that’s adequate (although I could see where it might be important for Server.) . But if one needed to be picky and knew the offsets he could consider a ‘universal’ superdate as the number of seconds since 1904-01-01T00:00:00Z and accurately tract time when/wherever. The current date/time conversion/math functions would be adequate for me if I could access the system time preference settings via PanX.
Panorama doesn’t have any built in way to access the system time zone or related settings. There is probably some way that this can be accessed via a shell command. Ok, I did a google search for this, you can use this formula to find the time zone offset from UTC.
On my computer at the moment this returns:
since California is currently 8 hours difference from UTC.
I found this information on this page:
That’s good enough. I know enough to use it. I hadn’t known enough to google or ask man pages the right question, so thanks for finding this for me!