FW: How to support such capabilites based on current Olson Time Zone implementation
I'm forwarding this message from Martin Dong, who is not on the time zone mailing list. Those of you who are on the time zone mailing list should direct replies appropriately. --ado From: Martin Dong [mailto:cppcraze@gmail.com] Sent: Friday, July 27, 2007 12:56 AM To: tz@lecserver.nci.nih.gov Subject: How to support such capabilites based on current Olson Time Zone implementation Dear All in this maillist, We have been investigating the feasibility of migrating Olson Time Zone Database to our system. Given that our system is Linux-based, we can just use tzcode implementation or Glibc functions because Glibc has adopted Olson implementation to some extent. But according to our basic and existing requirements, I have met some problems that I think are hard for me: * How to get the local time of different region or city at the same time? The basic requirement is to display the local time of different region or city at the same time. After some study of Olson implementation, I knew function "localtime" will handle everything, parsing tzfile and doing the conversion from utc to local time. The correct local time can be gotten through a simple invocation to "localtime". But "localtime" assumes the Sytem Local Time Zone is set in environmental variable "TZ" or from the Standard TimeZone file "/etc/localtime" if "TZ" is not defined in the process. In this case, how can a caller get the local time of some city which is not the System Local Time Zone? It seems we must change "TZ" or the Standard TimeZone file before calling "localtime" to get another city's local time because "localtime" doesn't take such an argument that can let caller specify a time zone, which means "localtime" can return the local time related to either the System Local Time Zone or the time zone user specifies. Although I know there're so many applications which already integrates the Olson Database and they have realized my above requirement "display multiple local time at the same time", I don't know how they make it. * How to get the notification of DST status change as time elaspes? This problem is out of our another requirement that we need to inform other components in our system of the DST status change in various conditions, such as changing time may lead to DST change, changing local time zone may lead to DST change, and as time elapsing, etc. The former two behaviors are user-active ones, we can track the change easily, but the problem is the last one, it's the system automatic behavior, our of the control of user. In this case, the system needs some CALLBACK ability to capture this change and further broadcast it. For our system, there's an Alarm Server that can provide timer machinasm. We will parse our own time zone database and get the next nearest DST transition time and add it to Alarm Server, then when the timer is time out, Alarm Server will trigger a CALLBACK function to further process. But it seems Olson is lack of such capability. After thinking from another perpsective, if we can get the next nearest DST transition time through Olson Time Zone database, we can still utilize our current Alarm Server. But it's still a problem how to get the next nearest DST transition time through the current Olson implementation because all the implementation is hiden behind "localtime". In all the public functions, there's no such one which can support getting the DST transition time. I don't have any good idea in mind right now. Should I make some modification to Olson to add such capability, or other way i could go? I will very much appreciate if any of you can give me some hints about above problems. Thank you in advance. Best Regards, -Martin
Dear Martin, For at least the first requirement, you might want to try other time zone support libraries listed on this list's homepage [1], for example ICU [2]. You could also send an email to the icu-support mailing list [3] to see if your second can be provided for. [1] http://www.twinsun.com/tz/tz-link.htm [2] http://icu-project.org/ [3] http://icu-project.org/contacts.html Best regards, markus
For the second requirement "getting the next nearest DST transition time", next version of ICU (ICU 3.8) will provide the API. -Yoshito "Markus Scherer" <markus.icu@gmail.com> wrote on 07/27/2007 02:38:00 PM:
Dear Martin,
For at least the first requirement, you might want to try other time zone support libraries listed on this list's homepage [1], for example ICU [2]. You could also send an email to the icu-support mailing list [3] to see if your second can be provided for.
[1] http://www.twinsun.com/tz/tz-link.htm [2] http://icu-project.org/ [3] http://icu-project.org/contacts.html
Best regards, markus
Dear Markus and Yoshito, Thanks for leading me to ICU project, which is really a full-featured library for internationalization. I feel it's more appropriate to consider using it from the very initial system design. However our system has already had its own internationalization mechanism, now we only want to utilize Olson Time Zone database. We need a light-weight solution but I think ICU is too heavy for us. Actually tzcode is a light-weight implementation, if I can make some change based on it to support what I want, I think it's enough. Dear Olson, I want to know more about tzfile in binary form. Is there any other detailed description? I feel it's a little bit hard to get it understood just through the tzcode (because the comments are vrey few:-). Btw, for now can any new functionality be added into tzcode implementation? Or another question, if my change can meet my requirements and it goes into our system, does it need to go into Olson tzcode? Sincerely, -Martin On 7/28/07, yoshito_umaoka@us.ibm.com <yoshito_umaoka@us.ibm.com> wrote:
For the second requirement "getting the next nearest DST transition time", next version of ICU (ICU 3.8) will provide the API.
-Yoshito
"Markus Scherer" <markus.icu@gmail.com> wrote on 07/27/2007 02:38:00 PM:
Dear Martin,
For at least the first requirement, you might want to try other time zone support libraries listed on this list's homepage [1], for example ICU [2]. You could also send an email to the icu-support mailing list [3] to see if your second can be provided for.
[1] http://www.twinsun.com/tz/tz-link.htm [2] http://icu-project.org/ [3] http://icu-project.org/contacts.html
Best regards, markus
participants (4)
-
Markus Scherer -
Martin Dong -
Olson, Arthur David (NIH/NCI) [E] -
yoshito_umaoka@us.ibm.com