Re: Getting GMT time



Anonymous AtWork wrote:
Bryan Oakley wrote:

Anonymous AtWork wrote:

I want to know what the GMT time is. If I do [clock seconds], I get the local time. I can add 5 hours, but what about DST when it is 6 (or 4--whatever the difference is). There's probably some kind of non-portable craziness I could do to find out what TZ the computer is in and figure out the local algorithm for adjustment thereof, but since Tcl already knows all that (right?) it seems like it could do it for me.

Is there a simple, 2-3 line way to do this?



Look at the clock man page, especially where it mentions the -gmt option to "clock format".



That will *format* the number of seconds I have as a GMT time. But the number of seconds I have isn't GMT, it's local. Given the local time, I want to know the GMT time.

Why in the world would you think the seconds returned by [clock seconds] is local?


BTW, did you even try what Bryan suggested?
.



Relevant Pages

  • Re: Clock Adjust for HP49G and hp49g+ (50g)
    ... back on last sunday in Oktober, 3.00 h local time. ... to DST on 2nd sunday in March, ... daylight saving time to 1:00 A.M. local standard time, ... I'm not sure of what, if any, effect the DST "fall back" switch ...
    (comp.sys.hp48)
  • Re: DST Adjustments
    ... 'transition' occurs, it saves the next transition time (it saves the October ... current DST flag at that point. ... the current local time to the saved, ... >> way to do it is using local time and system time. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: What time is it? Issues with Local time, system time, DST
    ... system time following a reboot? ... and we don't seemed to have "manually" restored the DST ... be for local time, not UTC. ... current time based on contents of battery backed RTC. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: [OT] How to get uclibc style timezone string (e.g GMT+0IST-1,M3.5.0/01:00:00,M10.5.0/02:00:0
    ... The best reason I can think of is to check in advance whether the local time ... E.g. when the U.S. rules for DST were changed then users would also have ... The Olson time zone files contain also the history of DST rules, ... can convert UTC time to local time correctly for years ago. ...
    (comp.protocols.time.ntp)
  • Re: Getting GMT time
    ... Anonymous AtWork wrote: ... local time. ... but what about DST when it is 6. ... There's probably some kind of non-portable craziness I could do to find out what TZ the computer is in and figure out the local algorithm for adjustment thereof, but since Tcl already knows all that it seems like it could do it for me. ...
    (comp.lang.tcl)