Re: Getting GMT time



Anonymous AtWork wrote:
Bryan Oakley wrote:

Anonymous AtWork wrote:

I want to know what the GMT time is.  ...
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.

The only difference in time between here (pick your own definition for "here) and GMT is the formatting, so I'm not sure what you're asking.


How is what I suggested not what you want? Does the following code print something that is unexpected for you?

  % set now [clock seconds]
  1135889846
  % clock format $now
  Thu Dec 29 14:57:26 -0600 2005
  % clock format $now -gmt 1
  Thu Dec 29 20:57:26 +0000 2005
.



Relevant Pages

  • Re: Getting GMT time
    ... Anonymous AtWork wrote: ... but what about DST when it is 6. ... Given the local time, I want to know the GMT time. ... BTW, did you even try what Bryan suggested? ...
    (comp.lang.tcl)
  • 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)
  • Re: Getting GMT time
    ... Anonymous AtWork wrote: ... but what about DST when it is 6. ... Look at the clock man page, especially where it mentions the -gmt ... Given the local time, I want to know the GMT time. ...
    (comp.lang.tcl)