Re: Getting GMT time



Kevin Kenny wrote:
Stefaan wrote:

I use following algoritm to determine the GMT time to calculate planet positions

[snip]

## Following command will convert the local time t to GMT time

clock scan [clock format $t -format "%Y-%m-%d %H:%M:%S" -gmt 1]
1136022869


That is just plain wrong.

Whatever you might believe, [clock seconds] returns the number of
nominal seconds since 00:00 UTC, 1 January 1970.  There is no such
thing as "local seconds" in Tcl.  All time zone conversion happens
inside [clock scan] and [clock format].  If [clock seconds] reports
time in the local time zone and not UTC, that is a bug.  (Nobody
has reported such a bug - and since I'm the mainainer of [clock],
I'd surely know if anyone had.)


-- 73 de ke9tv/2, Kevin

OK, I shouldn't have set the starting value with [clock seconds]. But if the starting value represents a local time, not obtained from TCL build-in commands, then in my opinion the algoritm works.
.




Relevant Pages

  • Re: Question about ISO8601 vs. strftime()
    ... online references to ISO8601 just get it wrong? ... that link only shows the form with the UTC ... but not the offset as far as I can tell. ... assumed to be in some local time zone. ...
    (comp.programming)
  • Re: Time Zones as politics
    ... be in a different time zone from his arch-rival, ... we are not permitted to criticize him in any way because after ... UTC +5 AKA Eastern Standard Time. ... Soon upon the establishment of the Greenwhich Meridian as the time ...
    (alt.horology)
  • Re: Received mail timestamp is off by 7 hours
    ... It should be one hour ahead of UTC right now. ... Notice that the timestamp on your local e-mail server corresponds to ... the CMOS real-time clock should be set to ... UTC and fix your time zone to match your location. ...
    (freebsd-questions)
  • Re: SWbemDateTime to Win 2k Compatible
    ... UUU is number of minutes to subtract from current time to get UTC. ... The TimeWritten property is not an Integer8 value, ... ' Get current date/time less 2 hours. ... This assumes your time zone bias is -480 minutes. ...
    (microsoft.public.scripting.vbscript)
  • Re: time zone questions (TIP#173 related...)
    ... TIP#173 seems to have addressed this basic problem for Tcl 8.5, in particular extending to allow rendering in an arbitrary timezone. ... though I'm looking nervously at the huge pile of 'tzdata' files and the deployment issues that brings. ... For example, my app won't need to deal with time zone settings in the past, so a lot of the historical data isn't relevant. ...
    (comp.lang.tcl)