Hi All, My goal is to provide a user interface showing the information derived from the TZ zone name. Based on the selected TZ zone name by the user, I will assign the corresponding POSIX time zone string to the Linux /tmp/TZ file. This way the local time will show up properly for the user. However, I am having difficulty to find a reliable source for POSIX time zone string representation for each defined time zone in the Olson database. Also, the Olson database is changing many times a year which is making it difficult to hardcode anything in advance. I am sure that my problem already encountered by someone on this mailing list and I am wandering if there is a way to query the current version of the Olson database with some tool to return the related POSIX representation for the requested time zone. I don't know if there is an alternative way, but I am also wandering if the TZ time zone name can used directly without going through the POSIX representation of the time zone. Note: POSIX time zone representation for me is the following. The TZ zone name America/Los_angeles is represented as PST8PDT,M3.2.0,M11.1.0. Regards, Louis Guindon PMC-Sierra Senior System Design Engineer
On Nov 13, 2008, at 3:05 PM, Louis Guindon wrote:
My goal is to provide a user interface showing the information derived from the TZ zone name. Based on the selected TZ zone name by the user, I will assign the corresponding POSIX time zone string to the Linux /tmp/TZ file. This way the local time will show up properly for the user.
I.e., you're trying to make an application to give the user a list of time zones, let them select a time zone, and make that the system time zone? Note that most if not all Linux systems use the Olson time zone database, so they are not required to have a POSIX time zone string as the time zone setting.
However, I am having difficulty to find a reliable source for POSIX time zone string representation for each defined time zone in the Olson database.
There isn't necessarily a POSIX time zone string representation for each defined time zone. POSIX time zone strings can't represent an arbitrary Olson-style time zone - they can't, for example, handle time zones where the rules change from year to year.
I don’t know if there is an alternative way, but I am also wandering if the TZ time zone name can used directly without going through the POSIX representation of the time zone.
On many UN*Xes, it can (Solaris, most if not all other SVR4 derivatives, most if not all Linux distributions, {Free,Net,Open,DragonFly}BSD, Mac OS X/iPhone OS).
Hi Guy, So, yes I am trying to make an application list of time zone and let them select a time zone and make that the system time zone. This application is aimed for an embedded platform where a limited set of Linux functionalities is available. Uclibc is used on the platform and the /etc/timezone and the whole zoneinfo directory tree are not supported. The feature where the POSIX time zone echoed to /tmp/TZ and the busybox date command are working well together. But a POSIX string for the timezone is required. Regards, Louis -----Original Message----- From: Guy Harris [mailto:guy@alum.mit.edu] Sent: Thursday, November 13, 2008 4:31 PM To: tz@lecserver.nci.nih.gov Subject: Re: Posix Timezone format On Nov 13, 2008, at 3:05 PM, Louis Guindon wrote:
My goal is to provide a user interface showing the information derived from the TZ zone name. Based on the selected TZ zone name by the user, I will assign the corresponding POSIX time zone string to the Linux /tmp/TZ file. This way the local time will show up properly for the user.
I.e., you're trying to make an application to give the user a list of time zones, let them select a time zone, and make that the system time zone? Note that most if not all Linux systems use the Olson time zone database, so they are not required to have a POSIX time zone string as the time zone setting.
However, I am having difficulty to find a reliable source for POSIX time zone string representation for each defined time zone in the Olson database.
There isn't necessarily a POSIX time zone string representation for each defined time zone. POSIX time zone strings can't represent an arbitrary Olson-style time zone - they can't, for example, handle time zones where the rules change from year to year.
I don't know if there is an alternative way, but I am also wandering if the TZ time zone name can used directly without going through the POSIX representation of the time zone.
On many UN*Xes, it can (Solaris, most if not all other SVR4 derivatives, most if not all Linux distributions, {Free,Net,Open,DragonFly}BSD, Mac OS X/iPhone OS).
On Nov 13, 2008, at 4:48 PM, Louis Guindon wrote:
This application is aimed for an embedded platform where a limited set of Linux functionalities is available. Uclibc is used on the platform and the /etc/timezone and the whole zoneinfo directory tree are not supported.
That's unfortunate - my mobile phone has (at least in the first OS release, according to a list of files given by its jailbreakers) the full Olson timezone database on it. (Then again, my mobile phone apparently has 128MB of main memory, and has 8GB of flash memory; maybe your embedded platform is a bit smaller.)
The feature where the POSIX time zone echoed to /tmp/TZ and the busybox date command are working well together. But a POSIX string for the timezone is required.
Unfortunately, that is an insoluble problem in the general case; the Olson timezone mechanism is more powerful than the POSIX time zone specification - a POSIX time zone can't, for example, handle a locale where the starting and ending dates for daylight savings time change arbitrarily every year, while the Olson code can. At best, you could, for example, have a program that reads the source files for the Olson database and picks the *last* start-of-DST and end- of-DST transition rules and constructs a POSIX time zone value from them. It might be possible to modify the zic program (the program that reads the source files and generates the binary files from them).
At best, you could, for example, have a program that reads the source
files for the Olson database and picks the *last* start-of-DST and end- of-DST transition rules and constructs a POSIX time zone value from them. It might be possible to modify the zic program (the program that reads the source files and generates the binary files from them).
Recent-vintage time zone binary files end with either a line that's the POSIX time zone value (or a blank line if a POSIX value can't represent future transitions). --ado
"Guy" == Guy Harris <guy@alum.mit.edu> writes:
Guy> On Nov 13, 2008, at 4:48 PM, Louis Guindon wrote:
This application is aimed for an embedded platform where a limited set of Linux functionalities is available. Uclibc is used on the platform and the /etc/timezone and the whole zoneinfo directory tree are not supported.
Guy> That's unfortunate - my mobile phone has (at least in the first Guy> OS release, according to a list of files given by its Guy> jailbreakers) the full Olson timezone database on it. (Then Guy> again, my mobile phone apparently has 128MB of main memory, and Guy> has 8GB of flash memory; maybe your embedded platform is a bit Guy> smaller.) It doesn't take much memory to store the Olson database if you tweak zic to omit any historic data. In other words, if you need to show current time, or perhaps timestamps going back to V1.0 release which is a few years ago, that's only a small number of bits. The reason is that there are several hundred zone names but the vast majority duplicate data for another zone, IF you keep only recent data. If you include all the history then there's very little duplication -- but typically that non-duplicate entry is one from a century ago... (That might be a nice standard feature for zic -- a switch that says "keep only data from this date forward". paul
participants (4)
-
Guy Harris -
Louis Guindon -
Olson, Arthur David (NIH/NCI) [E] -
Paul Koning