Poster | Thread |
Thematic
|  |
ARexx and locale stuff Posted on 20-Jun-2009 17:47:19
| | [ #1 ] |
|
|
 |
Super Member  |
Joined: 28-Oct-2003 Posts: 1616
From: I'm actually flying into a bug! | | |
|
| Any suggestions how to get timezone information into ARexx programs, preferably across the board (OS 3.x and later)? I know OS4 has TZONE env variable but I can't find docs... _________________ : AmigaOneXE (unmod.) 750FX/512 MB +stuff & AmigaOS 4.(0|1) : A1200/68060&96MB/SCSI/EM1200-Voodoo3 & OS 3.5 : A500/1MB : Pegasos (ff) 512 MB & MorphOS Praise seitan. |
|
Status: Offline |
|
|
ZeroG
|  |
Re: ARexx and locale stuff Posted on 21-Jun-2009 7:38:55
| | [ #2 ] |
|
|
 |
Cult Member  |
Joined: 16-Jul-2004 Posts: 544
From: Germany | | |
|
| @Thematic
The TZONE env variable is descriped in the timezone.library autodoc, look in the SDK. Last edited by ZeroG on 21-Jun-2009 at 09:36 AM.
|
|
Status: Offline |
|
|
AmigaPhil
 |  |
Re: ARexx and locale stuff Posted on 21-Jun-2009 17:01:56
| | [ #3 ] |
|
|
 |
Cult Member  |
Joined: 21-Jan-2005 Posts: 563
From: Earth (Belgium) | | |
|
| @Thematic
You could have a look at NetClock on Aminet (it's all in ARexx).
NetClock.rexx first check for the availability of a DSTRULE in its own configuration file. This variable has all the info needed to manage local time; that is, the timezone offset and the start/end of Daylight Saving Times. Check "NetClock.conf" for details about the format of the string.
If there is no DSTRULE, Netclock.rexx then check for a TZ env variable. TZ can be: - short: only holding the timezone offset, - long: holding the timezone offset and the DST start/end (The 'long' TZ variable also has all the needed info for calculating local time, as in NetClock's DSTRULE, but the string has a different structure which is documented on Internet.)
If there is no TZ env. var., then NetClock.rexx try to retrieve the timezone offset from "locale.prefs".
(I don't know about OS4.x, but the TZONE env. var. used on OSes <4 only holds the timezone offset. That's why NetClock check for TZ and not for TZONE.)
Hope this help.
Last edited by AmigaPhil on 21-Jun-2009 at 05:02 PM.
|
|
Status: Offline |
|
|
AmigaPhil
 |  |
Re: ARexx and locale stuff Posted on 10-Aug-2009 1:23:29
| | [ #4 ] |
|
|
 |
Cult Member  |
Joined: 21-Jan-2005 Posts: 563
From: Earth (Belgium) | | |
|
| @ZeroG
You wrote: Quote:
The TZONE env variable is descriped in the timezone.library autodoc, look in the SDK. |
and I wrote: Quote:
(I don't know about OS4.x, but the TZONE env. var. used on OSes <4 only holds the timezone offset. That's why NetClock check for TZ and not for TZONE.) |
I would like to have a look at the TZONE format and description without having to download and unpack the >50 Mb SDK file. Is there any other info source available (online) about this env. variable used in OS4.x ?
|
|
Status: Offline |
|
|
ZeroG
|  |
Re: ARexx and locale stuff Posted on 10-Aug-2009 15:20:53
| | [ #5 ] |
|
|
 |
Cult Member  |
Joined: 16-Jul-2004 Posts: 544
From: Germany | | |
|
| @AmigaPhil
No, there is no other source. Here is the part of timezone.library autodoc you need: Quote:
timezone.library maintains a global environment variable called "TZONE" which contains current time zone names and UTC (GMT) offsets. It has the following format:
std offset [dst [offset]]
(the spaces are for clarity only and should be ommited)
where:
std and dst are 3 or more characters specifying the local standard and daylight saving time (DST) zone names.
offset is of the form [-]hh:[mm[:ss]] and specifies the offset west of UTC.
If there is no offset following dst, daylight saving time is one hour ahead of standard time.
If the 'dst offset' part is absent, system time represents standard time, if it is present, system time means daylight saving time.
offset always specifies the absolute offset of the zone from UTC so if standard time applies, 'std offset' part should be used and if DST is in effect, the 'dst offset' should be used.
EXAMPLE EST5 standard time is in effect, the current timezone is called EST and you are 5 hours west of UTC.
CST-9:30CST-10:30 DST is in effect, the current timezone is called CST and you are 10 hours, 30 minutes east of UTC.
CET-1CEST DST is in effect, the current timezone is called CEST and you are 2 hours east of UTC.
|
|
|
Status: Offline |
|
|
AmigaPhil
 |  |
Re: ARexx and locale stuff Posted on 10-Aug-2009 20:19:42
| | [ #6 ] |
|
|
 |
Cult Member  |
Joined: 21-Jan-2005 Posts: 563
From: Earth (Belgium) | | |
|
| @ZeroG
Thanks !
So no surprise here: Posix compliant, and the same format as used on older/alternate OSes (at least, the ones created by third party applications I know about. This was not always the case with the TZ env, where some applications use their own (incompatible) format.)
So, as TZONE exists by default on OS4.x, and as TZONE can also be available on other OSes, I think a good habit to take when looking for the timezone of a local machine is to: - First check for TZONE, it gives the current timezone offset (summertime or not); - If no TZONE, check for TZ (which should contain at least the same info as in TZONE); - If no TZONE and no TZ are available: (- eventually try to peek the locale.prefs for the timezone offset (no DST here), and if it fails...) - prompt the user of the application that a TZONE (or TZ) environment variable is needed.
|
|
Status: Offline |
|
|