Disregard daylight saving time
Author |
Message |
Helmut Gie #1 / 23
|
 Disregard daylight saving time
Hello out there, is it possible, to make Tcl somehow ignore daylight saving time? I know, that it is a feature, but consider: There is data logger standing somewhere in Greece. This poor, dumb machine has never heard of daylight saving time - it just collects data and time stamps them according to its internal clock. Now data gets transferred here, and things start to get annoying, because my smart PC / Tcl knows about DST. Since many scientific institutions purposefully ignore DST, there should be techniques around on how to handle this situation. Any ideas, proposals or links will be greatly appreciated. Helmut
|
Wed, 14 Apr 2004 00:56:54 GMT |
|
 |
Laurent Duperva #2 / 23
|
 Disregard daylight saving time
Quote: > Hello out there, > is it possible, to make Tcl somehow ignore daylight saving time? I know, > that it is a feature, but consider: There is data logger standing > somewhere in Greece. This poor, dumb machine has never heard of daylight > saving time - it just collects data and time stamps them according to > its internal clock. Now data gets transferred here, and things start to > get annoying, because my smart PC / Tcl knows about DST. Since many > scientific institutions purposefully ignore DST, there should be > techniques around on how to handle this situation. > Any ideas, proposals or links will be greatly appreciated. Helmut
Something like using GMT? L --
Qu'est-ce que je cause bien tout de mme! -Lonard le gnie
|
Wed, 14 Apr 2004 01:50:37 GMT |
|
 |
Helmut Gie #3 / 23
|
 Disregard daylight saving time
On Fri, 26 Oct 2001 13:50:37 -0400, Laurent Duperval Quote:
>> Any ideas, proposals or links will be greatly appreciated. Helmut >Something like using GMT?
Maybe? Apparently you see a relation there. I know that there is this 'GMT' option, but from the docs I didn't glean any connection to DST. Could you please elaborate a bit? Best regards Helmut
|
Wed, 14 Apr 2004 04:04:46 GMT |
|
 |
David N. Welt #4 / 23
|
 Disregard daylight saving time
Quote:
> On Fri, 26 Oct 2001 13:50:37 -0400, Laurent Duperval
> >> Any ideas, proposals or links will be greatly appreciated. Helmut > >Something like using GMT? > Maybe? Apparently you see a relation there. I know that there is this > 'GMT' option, but from the docs I didn't glean any connection to DST. > Could you please elaborate a bit?
Have the data logger send time in a format similar to [clock seconds], if possible. That way it's pretty hard to mess up. -- David N. Welton Consulting: http://www.dedasys.com/ Free Software: http://people.debian.org/~davidw/ Apache Tcl: http://tcl.apache.org/ Personal: http://www.efn.org/~davidw/
|
Wed, 14 Apr 2004 09:32:42 GMT |
|
 |
Helmut Gie #5 / 23
|
 Disregard daylight saving time
Quote: >Have the data logger send time in a format similar to [clock seconds], >if possible. That way it's pretty hard to mess up.
If life were so easy. No, I've got to take what's being handed to me. Helmut
|
Wed, 14 Apr 2004 21:19:18 GMT |
|
 |
Jeffrey Hobb #6 / 23
|
 Disregard daylight saving time
... Quote: > >Something like using GMT? > Maybe? Apparently you see a relation there. I know that there is this > 'GMT' option, but from the docs I didn't glean any connection to DST.
IIRC, and the RFCs are probably more clear on this, the GMT "time zone" has no daylight savings time ever. This means you don't have to worry about the switch-over if you always operate scan and format with -gmt true. -- Jeff Hobbs The Tcl Guy Senior Developer http://www.ActiveState.com/ Tcl Support and Productivity Solutions
|
Thu, 15 Apr 2004 00:31:05 GMT |
|
 |
Helmut Gie #7 / 23
|
 Disregard daylight saving time
Quote: >IIRC, and the RFCs are probably more clear on this, the GMT >"time zone" has no daylight savings time ever. This means >you don't have to worry about the switch-over if you always >operate scan and format with -gmt true.
Thanks Jeffrey, but unfortunately - no. I made some test procs, so if anybody wants to play around with this topic, just go ahead. If you think of something, be sure to let me know. Helmut PS: I know that in the manual it says, that DST correction is only applied if you use a "relative time" >= day. But what I (e.g.) want to do is collect monthly data, so the march should have [expr 31 * 24 * 3600] seconds - and with DST I get into problems here. --- proc month2Secs { month year {gmt 0} } { set start [clock scan "$year-$month-1" -gmt $gmt] set next [clock scan "1 month" -base $start -gmt $gmt] return [expr $next - $start] Quote: }
proc interprete { sec } { set oneDay [expr 24 * 60 * 60] set days [expr $sec / $oneDay] set rest [expr $sec % $oneDay] if { !$rest } { puts "$sec seconds are exactly $days days" } elseif { $rest < [expr $oneDay / 2] } { puts "$sec seconds are $days days plus $rest seconds" } else { incr days puts "$sec seconds are $days days minus [expr $oneDay - $rest] seconds" } Quote: }
puts "Testing for Oct. 2001" interprete [month2Secs 10 2001] puts "Testing for Oct. 2001 with GMT" interprete [month2Secs 10 2001 1] puts "Testing for March 2001" interprete [month2Secs 3 2001] puts "Testing for March 2001 with GMT" interprete [month2Secs 3 2001 1] ---
|
Thu, 15 Apr 2004 01:43:29 GMT |
|
 |
Ralf Fasse #8 / 23
|
 Disregard daylight saving time
| I made some test procs, so if anybody wants to play around with this | topic, just go ahead. If you think of something, be sure to let me | know. % echo $TZ MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 % tclsh /tmp/test.tcl Testing for Oct. 2001 2682000 seconds are 31 days plus 3600 seconds Testing for Oct. 2001 with GMT 2682000 seconds are 31 days plus 3600 seconds Testing for March 2001 2674800 seconds are 31 days minus 3600 seconds Testing for March 2001 with GMT 2674800 seconds are 31 days minus 3600 seconds % unsetenv TZ % tclsh /tmp/test.tcl Testing for Oct. 2001 2678400 seconds are exactly 31 days Testing for Oct. 2001 with GMT 2678400 seconds are exactly 31 days Testing for March 2001 2678400 seconds are exactly 31 days Testing for March 2001 with GMT 2678400 seconds are exactly 31 days => unset TZ in environment before starting your analysis program? R'
|
Fri, 16 Apr 2004 17:20:10 GMT |
|
 |
Helmut Gie #9 / 23
|
 Disregard daylight saving time
Hi Ralf, this is interesting. I *don't have* TZ set (never botheed). It's not in my environment and if I say "echo $TZ" I get (correctly) can't read "TZ": no such variable BTW, what does >MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 amount to and how does it get set? Best regards Helmut
|
Fri, 16 Apr 2004 20:57:12 GMT |
|
 |
Ulrich Sch?be #10 / 23
|
 Disregard daylight saving time
MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 means Standard Timezone is MET, 1 hour east of Greenwich, Daylight Saving Time is MDT, 2 hours from GMT, start MDT on last Sunday of March at 2am, reset to MET on last Sunday of October at 3am (which I believe is wrong). AFAIK, there's a file /etc/TIMEZONE containing the lines TZ=MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 export TZ Best regards Ulrich
Quote: > Hi Ralf, > this is interesting. I *don't have* TZ set (never botheed). > It's not in my environment and if I say "echo $TZ" I get (correctly) > can't read "TZ": no such variable > BTW, what does > >MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 > amount to and how does it get set? > Best regards > Helmut
|
Sat, 17 Apr 2004 00:29:38 GMT |
|
 |
Ralf Fasse #11 / 23
|
 Disregard daylight saving time
| reset to MET on last Sunday of October at 3am (which I believe is | wrong). But rather should be...? AFAIK the `analog' procedure is to set back the wall clock one hour, preferably during the night at 3am? | AFAIK, there's a file /etc/TIMEZONE containing the lines | | TZ=MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 | export TZ Yup, where the file location is system-dependend. More recent methods for dealing with DST is table-driven lookups, since the above setting of one TZ disregards historic changes in DST (September/October), and is plain wrong for epochs where DST was not applicable (eg. years < 197x). R'
|
Sat, 17 Apr 2004 02:18:16 GMT |
|
 |
Ralf Fasse #12 / 23
|
 Disregard daylight saving time
| this is interesting. I *don't have* TZ set (never botheed). ? Which OS is this? Windows? | BTW, what does | >MET-1MDT-2,M3.5.0/2:00,M10.5.0/3:00 | amount to and how does it get set? See explanation of Ulrich in
R'
|
Sat, 17 Apr 2004 02:20:28 GMT |
|
 |
Helmut Gie #13 / 23
|
 Disregard daylight saving time
Quote:
>| this is interesting. I *don't have* TZ set (never botheed). >? Which OS is this? Windows?
Yes, Win98 to be exact. Helmut
|
Sat, 17 Apr 2004 04:14:13 GMT |
|
 |
Helmut Gie #14 / 23
|
 Disregard daylight saving time
Quote: ><!doctype html public "-//w3c//dtd html 4.0 transitional//en"> ><html> >If using a Microsoft operating systems and you want to use GST, set the >time zone to 'GST Casablanca/Monrovia" which does not use daylight >saving time. The other "GST" entry while correct for the British >Isles does employ day light saving time.</html>
Thanks for the hint. If it does change the behaviour, it's a very interesting case of loop hopping. Best regards Helmut
|
Sat, 17 Apr 2004 04:16:12 GMT |
|
 |
Ralf Fasse #15 / 23
|
 Disregard daylight saving time
| >? Which OS is this? Windows? | Yes, Win98 to be exact. Well, windows does not per se use/set TZ, rather you set the timezone in some GUI dialog. I don't know how Tcls time functions work in that environment, but obviously they look at that OS-setting. (In addition I found in cygwin that they *sometimes* obey TZ (which gives very irritating results)). In your case I'd stick with the method suggested by someone else and set the global computer timezone to some non-DST zone. Recently I stumbled across some link describing the differences in handling of DST in Linux and Windows on the same PC, but I've lost the pointer :-/. IIRC the digest was that Windows changes the HWclock for DST changes, where Linux does not, so the two are mutually exclusive w/ regards to automatic DST switching. R'
|
Sat, 17 Apr 2004 17:00:55 GMT |
|
|
Page 1 of 2
|
[ 23 post ] |
|
Go to page:
[1]
[2] |
|