Click Here
home features news forums classifieds faqs links search
6225 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
22 crawler(s) on-line.
 95 guest(s) on-line.
 1 member(s) on-line.


 OneTimer1

You are an anonymous user.
Register Now!
 OneTimer1:  56 secs ago
 matthey:  1 hr 20 mins ago
 outlawal2:  1 hr 49 mins ago
 amyren:  1 hr 52 mins ago
 AGABerg:  4 hrs 8 mins ago
 clint:  4 hrs 13 mins ago
 BigD:  6 hrs 19 mins ago
 g.bude:  6 hrs 29 mins ago
 PhantomInterrogative:  7 hrs 23 mins ago
 BillE:  7 hrs 42 mins ago

/  Forum Index
   /  Amiga Development
      /  ARexx and locale stuff
Register To Post

PosterThread
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
Profile     Report this post  
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
Profile     Report this post  
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
Profile     Report this post  
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
Profile     Report this post  
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
Profile     Report this post  
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
Profile     Report this post  

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle