Home | Gallery | Forum | Services | Webmail | Archive | Links | Contact Us | About Us
OS2 World.Com Forum
OS2 World.Com Online Discussion Forum.
Index / OS/2 - SIGs / Doodle's ScreenSaver
author message
Clock modules and TZ variable
Post a new topic Reply to this Topic Printable Version of this Topic Forward this Topic to your Friend Topic Commands (for administrator or moderators only)
Adam
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 47
since: 05 Feb, 2005
1. Clock modules and TZ variable
Reply to this topic with quote Modify your message
Hi Doodle, I just noticed that after I set my hardware rtc to UTC time that the screen saver shows UTC time and not my local time. I do have a properly set tz variable in my config.sys.

Adam

Date: 11 Feb, 2007 on 01:23
Cris
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 124
since: 20 Nov, 2003
2. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
last updated at 11 Feb, 2007 23:33 (1 times)
Adam,
why did you set your rtc to UTC in the first place?
AFAIK keeping the hardware RTC set to UTC, and then calculating your local time using the TZ vatriable, was the default unix way of doing things. But on Winxx and OS/2 it has always been different: you keep your hw rtc set to your local time and then use TZ only when you need it (e.g. when dealing with dates from other time zones).
On recent Linux distros you have the choice of using the unix way or the Winxx way: it became necessary when people started installing Linux along with Windows on the same PC.

...or did I misinterpret your question?

Bye
Cris

Date: 11 Feb, 2007 on 23:33
Adam
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 47
since: 05 Feb, 2005
3. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
http://homepages.tesco.net/J.deBoynePollard/FGA/os2-apps-that-do-not-understand-timezones.html

Adam

Date: 12 Feb, 2007 on 00:47
rudi
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 35
since: 03 Oct, 2004
4. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
While setting the RTC to UTC in theory it the way to go and this will probaly work with the toolset presented on that page, it will break almost everything else. Unfortunately, there is no central place in the OS, that handles timezones. Thus, this is done by the runtime libraries used by the individual applications. And not even all of them (IBM, Borland) understand the Posix varient of the TZ syntax ! AFAIK, even GCC's lib was adapted to honour the IBM version of the TZ variable, just in order to be compatible with what is understood by the major part of the OS.

So you have to expect all kinds of timing related problems, if you set your RTC to UTC and run anything else but these command line utilities...

Date: 12 Feb, 2007 on 08:17
Doodle
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 52
since: 04 Jan, 2005
5. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Reading through this thread, I think I'll wait for the conclusion before doing any changes in the code.

I don't really know about TZ stuffs. I know what they are about, but never worried about them, I was always using the simple time() API to get the time and it worked so far...

Doodle

Date: 12 Feb, 2007 on 10:52
Cris
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 124
since: 20 Nov, 2003
6. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Adam,
I don't agree with JdBP. He may know better (he always seems to), but I think it's not a matter of what's broken or not broken: it's just a matter of the way you look at things. The fact is Unix looks at things one way, while DOS/eCS/Windows look at things the opposite way (regarding TZ). The Unix way may indeed be better, but that doesn't mean the other way is "broken".
Look at this thread, that should be enlightening: http://groups.archivesat.com/eComStation_installation/thread247511.htm

HTH
Bye
Cris

Date: 12 Feb, 2007 on 12:04
Adam
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 47
since: 05 Feb, 2005
7. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
I have already looked at that thread Cris before I even created this post. I am still inclined to agree with Jonathan on this one. It makes more sense to me. I respect y'alls' opinion though. It is not that big of a deal if Doodle wants to not mess with the timekeeping in the modules; after all, if it gets to be that big of a deal for me, I can just use a different module.

Adam

Date: 12 Feb, 2007 on 13:30
Sebadoh
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this memberhttp://www.newterrasoftware.com
posts: 198
since: 10 Apr, 2001
8. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
last updated at 12 Feb, 2007 21:46 (1 times)
I hate to say this but it is pointless. The TZ is quite likely the most unused part of the OS. As long as the clock in warp center or ecomcenter or whatever tells me the time it ACTUALLY is. I could care less how it comes to that conclusion. This is NOT important. Now, back to the original post, fixing the screen saver module to actually say the time it is, would be important.. but guess what, if he is querying the time from the system, and you for whatever reason have the clock set wrong, then set the clock back the way it should be!

No matter what YOU think is the right way, the computer clock is LOCAL time. It always has been and should always remain so.

Date: 12 Feb, 2007 on 21:45
Adam
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 47
since: 05 Feb, 2005
9. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Well, if some of you are going to get sensitive over this then I guess I shouldn't have posted this in the first place. I hope you don't have a cow Sebadoh over this. Like I said it actually isn't that big of a deal. I think it might be prudent if the administrator shut this thread down.

Adam

Date: 12 Feb, 2007 on 21:54
zircon
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 7
since: 03 May, 2005
10. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
I also set my hardware clock to UTC, as do some other people I work with. The rationale is to keep file dates coherent regardless of time zone and when traveling internationally. This does mean having to calculate local times for files when a program is unable to do so from the time zone variable, but for me it is sometimes necessary to be certain that the file time stamps are sequential.

I guess this is a non-issue to anyone who does not travel and does not share files with people from other time zones. However, it certainly would simplify things quite a bit if all computers would run on the same clock and would just display the date/time adjusted by locale.

Date: 13 Feb, 2007 on 03:58
Sebadoh
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this memberhttp://www.newterrasoftware.com
posts: 198
since: 10 Apr, 2001
11. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
last updated at 13 Feb, 2007 06:45 (1 times)

zircon (13 Feb, 2007 03:5:
I also set my hardware clock to UTC, as do some other people I work with. The rationale is to keep file dates coherent regardless of time zone and when traveling internationally. This does mean having to calculate local times for files when a program is unable to do so from the time zone variable, but for me it is sometimes necessary to be certain that the file time stamps are sequential.

I guess this is a non-issue to anyone who does not travel and does not share files with people from other time zones. However, it certainly would simplify things quite a bit if all computers would run on the same clock and would just display the date/time adjusted by locale.


I travel all over the country (and other countries) and this is never an issue.. so all my file dates are normalized to EST. So what? As long as there is a standard time that is all which matters, I do not change my clocks when I travel, only my watch so I know what time it is. 3pm EST is always 3pm EST. For any data which is sensitive I use version/revision information which I enter at time of creation.

The clock on the computer was not intended originally to calculate time zones, as a matter of fact most people never moved a PC AT/XT out of the time zone in which it was originally removed from it's box. This whole thing is such a non-issue.

Date: 13 Feb, 2007 on 06:43
Doodle
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 52
since: 04 Jan, 2005
12. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Okay, now going back on the original topic for a while:

I guess it's a personal preference, but I'm also in the favour of using UTC in behind, and modifying that time to match the current locale.

However, all this should be done (and it is meant to be done) by the OS, without the application knowing about it. (Actually, from a technical point of view, I think it's not the OS which is doing it but the runtime library of the C compiler.)

Now, I might be wrong, but all this means to me that it's my C compiler (OpenWatcom) which does not use the TZ variable correctly, or just simply does not handle it at all. (Rudi, any comments on this?)

I'll look after it, and let you know the results. However, if it turns out to be true, I'm afraid that there is not too much I can do about it.

Doodle

Date: 13 Feb, 2007 on 08:28
Cris
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 124
since: 20 Nov, 2003
13. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Doodle,
a computer has no means to know what time it *really* is. It has to make assumptions on the way the RTC is set.

In the DOS/eCS/Windows world the RTC is usually set to your local time. Software written for these OSes usually don't use TZ to calculate local time, otherwise they would be shifting a time that is already shifted at the origin.

TZ is only used by software that has to deal with dates coming from other time zones (and that has the means to *know* which are the time zones of origin). Examples in the eCS world are MUAs (for which the original TZ is in the header of the message) and the ZIP/UNZIP utilities (that store the original TZ in the header and then adjust file date/times accordingly upon decompression).

If you update your software to adjust the time by assuming that the RTC is set to UTC, you will screw up date/times on the vast majority of computers using eCS.
The only real solution would be to do the time-shift at the OS level. Again, software would not care about TZ and just keep the time as the OS supplies.

Note that most Linux distros are already doing this (you configure the way you want your RTC to work at installation time). And they are usually standardizing on having the RTC set to LOCAL time, not to UTC, to facilitate installation of Linux on dual-boot systems.

Bye
Cris

Date: 13 Feb, 2007 on 09:34
rudi
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 35
since: 03 Oct, 2004
14. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Doodle,

I cannot comment on OpenWatcom, but AFAIR "Closed Watcom" did use a syntax for TZ like this (Posix):

TZ=EST5EDT4,M4.1.0/02:00:00,M10.5.0/02:00:00

which contradicts to the version used by IBM-C and GCC:

TZ=CET-1CST,3,-1,0,7200,10,-1,0,10800,3600

in the way the days of the daylight saving switch are specified. With Borland C it's easier, because it ignores that part of TZ completely...

But besides that: all library implementations assume that the time obtained from the system is local time and use these variables to convert it to UTC. This cannot be undone by just changing some signs. The time() function as well and DosGetDateTime() will give incorrect results in case of the RTC running at UTC !

Assuming that your code is using time() to query date/time an localtime() to prepare for display, this will do the UTC conversion back anf forth resulting in exactly the same result as DosGetDateTime().

BTW, OS/2's DATETIME structure has a field specifying the offset to UTC, but AFAIK this is only set by some 3rd party tools...

As said before: If one would create a new OS, it's technically better to let the RTC run at UTC. But unfortunately OS/2 and it's applications are simply not made for this. Furthermore, it is not possible to change the behaviour, because there is no central place in the system (like a common C-library or a system API) where such a change would be effective for *ALL* applications.

Date: 13 Feb, 2007 on 10:27
Doodle
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 52
since: 04 Jan, 2005
15. Re:Clock modules and TZ variable
Reply to this topic with quote Modify your message
Okay, thanks for the explanations!

The conclusion for me is that don't set your time to UTC on OS/2, and everything will work properly. Otherwise you'll have problems in all kind of different applications.

I hereby declare this thread to be closed.

Doodle

Date: 13 Feb, 2007 on 12:37
Clock modules and TZ variable
Post a new topic Reply to this Topic Printable Version of this Topic Forward this Topic to your Friend Topic Commands (for administrator or moderators only)
All times are CET+1. < Prev. | P. 1 | Next >
Go to:
 

Powered by UltraBoard 2000 Standard Edition,
Copyright © UltraScripts.com, Inc. 1999-2000.
Home | Gallery | Forums | Services | Webmail | Archive | Links | Contact Us | About Us
© OS2 World.Com 2000-2004