Page 1 of 2
Timezone conversion
Posted: Tue Nov 18, 2014 12:49 pm
by abalaban
Is there a way to easily convert a (past) datetime value given in one timezone into another one?
Typically I'm receiving a string like "2014-10-18T10:05:10Z" and I would like to know what date and time it was using Paris timezone.
I'm able to parse the datetime value without problem but I'm stuck with the timezone conversion (nothing seems to be provided in timezone library where such function should reside IMHO).
Re: Timezone conversion
Posted: Tue Nov 18, 2014 3:11 pm
by tboeckel
Unfortunately there is no function (yet) in AmigaOS for this task. This is why YAM is using libtz to do the necessary conversion and to decide wether the given date/time was within DST or not. timezone.library can tell you if DST is active now, but not for an arbitrary date/time in the past or in the future. This is definitely something that needs to be added.
Re: Timezone conversion
Posted: Tue Nov 18, 2014 3:29 pm
by abalaban
Is binary port of libtz publically available somewhere?
I agree this is something that would be nice to address in the future. timezone.library autodoc currently seems to have plenty of room for such a thing

Re: Timezone conversion
Posted: Tue Nov 18, 2014 3:51 pm
by tboeckel
abalaban wrote:Is binary port of libtz publically available somewhere?
I doubt it. At least for YAM we are building libtz from scratch. It is only a very few files:
libtz in YAM
And it requires the
zoneinfo files for all the different locations on earth, each with its specific rules when DST was active in the the past.
Re: Timezone conversion
Posted: Tue Nov 18, 2014 11:08 pm
by nbache
tboeckel wrote:And it requires the
zoneinfo files for all the different locations on earth, each with its specific rules when DST was active in the the past.
Timezone.library already comes with the .timezone files (XML-based) which are installed in Locale:Timezones. Would it be possible/preferable to base any solution on those instead, so as not to need two different sets of files with (I assume) more or less the same info?
Best regards,
Niels
Re: Timezone conversion
Posted: Tue Nov 18, 2014 11:23 pm
by abalaban
No I doubt it because files used by libtz seems to be binaries while files from the timezone.library are (proprietary) xml files. I guess the only solution is to add such feature (convert an arbitrary date from a specified TZ to another one) to the timezone.library.
Re: Timezone conversion
Posted: Wed Nov 19, 2014 12:07 am
by nbache
abalaban wrote:I guess the only solution is to add such feature (convert an arbitrary date from a specified TZ to another one) to the timezone.library.
Yes, that was one of the solutions I hoped for to avoid duplicating the info in two types of files

. That would be perfect, IMHO.
Best regards,
Niels
Re: Timezone conversion
Posted: Wed Nov 19, 2014 8:51 pm
by xenic
nbache wrote:abalaban wrote:I guess the only solution is to add such feature (convert an arbitrary date from a specified TZ to another one) to the timezone.library.
Yes, that was one of the solutions I hoped for to avoid duplicating the info in two types of files

. That would be perfect, IMHO.
I think the timezone files in Locale/Timezones only contain current timezone data (change dates for DST). We would need the historical timezone data to account for changes in the DST dates. For example, the DST (daylight saving time) change dates in the U.S. were changed several years ago. Any calculations based on the current DST dates would be incorrect for dates preceeding those changes.
Re: Timezone conversion
Posted: Wed Nov 19, 2014 9:37 pm
by salass00
xenic wrote:
I think the timezone files in Locale/Timezones only contain current timezone data (change dates for DST). We would need the historical timezone data to account for changes in the DST dates. For example, the DST (daylight saving time) change dates in the U.S. were changed several years ago. Any calculations based on the current DST dates would be incorrect for dates preceeding those changes.
How many years would those "several years ago" be exactly?
If the change was made before the AmigaOS epoch (1.1.1978) then there isn't really any need to worry about it...
Re: Timezone conversion
Posted: Wed Nov 19, 2014 10:40 pm
by nbache
salass00 wrote:xenic wrote:I think the timezone files in Locale/Timezones only contain current timezone data (change dates for DST). We would need the historical timezone data to account for changes in the DST dates.
Right, of course. So, if these data are part of the zoneinfo files, maybe it would be wiser to make timezone.library ale to use thos instead of the ons it uses now.
For example, the DST (daylight saving time) change dates in the U.S. were changed several years ago. Any calculations based on the current DST dates would be incorrect for dates preceeding those changes.
How many years would those "several years ago" be exactly?
If the change was made before the AmigaOS epoch (1.1.1978) then there isn't really any need to worry about it...
No, there have been several changes, the latest in 2007:
http://en.wikipedia.org/wiki/History_of ... light_Time
And other places in the world have made changes as well within the Amiga epoch.
Best regards,
Niels