Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
49 user(s) are online (29 user(s) are browsing Forums)

Members: 0
Guests: 49

more...

Headlines

 
  Register To Post  

(solved) TZONE env var documentation looks wrong to me
Home away from home
Home away from home


See User information
I want to manually parse the "TZONE" enviromental variable, since it seems to standard on AmigaOS3 & OS4 (and so presumably AROS & MOS). However one of the examples it provides doesn't make ANY sense to me at all.

Here's what the OS4 SDK says, but this appears to be essentially unchanged from that provided with the OS3 program SetDST from 2001:
Quote:
a global environment variable called "TZONE" which contains current time zone names and UTC (GMT) offsets.

The TZONE variable has the following format:

std offset [dst [offset]]

NOTE: spaces are for clarity only and should be omitted.

Where:

std and dst
Are 3 or more characters specifying the local standard and daylight saving time (DST) zone names.

offset
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.


It's the last example which looks wrong to me. If we are 2 hours east of UTC, then the UTC offset is -2. The strange part is that if DST is in effect, then it means the system time is +1 hour further ahead, which is the equivalent of being 1 hour further east.

Therefore I would expect the UTC offset to be -3, but the example shows -1. Even if I assume we are supposed to calculate the DST offset ourselves, then the UTC offset is still -2. So I can't see any way in which being 2 hours east of UTC would produce a UTC offset of -1 !

The only way I *could* make sense of it is if "2 hours east of UTC" is not referring to the PHYSICAL location, but rather it was a highly obscure way of referring to the local time offset (including the 1 hour DST offset). But this seems an extremely perverse thing to do.

EDIT: OK, looks like they ARE using the "obscure way", since the previous example uses the same wierd phrasing, plus CET is officially defined as being 1 hour east of UTC.

Author of the PortablE programming language.
Go to top
Re: (solved) TZONE env var documentation looks wrong to me
Just can't stay away
Just can't stay away


See User information
@ChrisH
It looks to me like the last example should be: CET-1CEST-2
I just looked up the current times and got this:
UTC = 5:08PM
CET = 6:08PM
CEST = 7:08PM

Since you always subtract the time differential this would be true:
6:08PM(CET)=5:08PM(UTC)-(-1)
7:08PM(CEST)=5:08PM(UTC)-(-2)
Of course minus a negative number means add.

I think the last example should be:

CET-1CEST-2
DST is in effect, the current timezone is called CEST and you are 2 hours ahead of UTC.

If the author wanted to reference the time difference using (east/west) then the explanation should say:

DST is in effect, the current timezone is called CEST and you are the equivalent of 2 hours east of UTC with no DST in effect.

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project