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.
You didn't try it did you? It works as expected:
% clock format [clock seconds]
Fri Dec 30 8:31:45 AM Malay Peninsula Standard Time 2005
% clock format [clock seconds] -gmt 1
Fri Dec 30 12:31:48 AM GMT 2005
>>From the results I got, since Malaysian time is GMT+8, it looks like it
works (8:31 AM here means it's 31 minutes past midnight GMT).
Received on Tue Jan 3 03:09:42 2006