Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"clock" question

2 views
Skip to first unread message

Stuart

unread,
Nov 21, 2009, 8:23:33 PM11/21/09
to

I'm a little baffled by the following.. I clock scan the string
"00:00:00" with
the gmt flag set and I get an epochal time consistent with the
*previous* day.
By epochal time I mean time in seconds since Jan 1, 1970

These commands were all executed within a few seconds of each other
$ wish (Tcl/Tk 8.4)
% clock scan "00:00:00" -gmt 1
1258761600 ( This is Nov 21, 2009 00:00:00 )
% exit
$ date -u ( request the UTC time on my PC)
Sun Nov 22 01:07:47 UTC 2009 (clearly in Nov 22)
$ date +%s (request the epochal time on my PC)
1258852074 (this is consistent with above time as checked on another
system)

I don't understand why:
clock scan "00:00:00" -gmt 1

did not give 1258848000 ?

My system is a PC running RedHat Linux and is synced to a GPS clock.

Any ideas?

Thanks,

Stuart

Kevin Kenny

unread,
Nov 22, 2009, 12:03:47 AM11/22/09
to
Stuart wrote:
> I don't understand why:
> clock scan "00:00:00" -gmt 1
>
> did not give 1258848000 ?

Bug in 8.4. Fixed in 8.5.

The 8.4 code was mistakenly computing 00:00:00 UTC on the current
calendar day in the current timezone. Since the current timezone
was west of Greenwich, the current calendar day in the current timezone
happened to be a day behind the current calendar day in Greenwich.

--
73 de ke9tv/2, Kevin

Stuart

unread,
Nov 22, 2009, 3:16:23 AM11/22/09
to

There are no 8.4 version with this bug fixed? If the system
time zone is set to GMT should that suffice for a work around?

Drag.

Stuart

Stuart

unread,
Nov 23, 2009, 7:21:00 PM11/23/09
to


Actually one can do:

set now [clock seconds]
set cur_day_epoch [expr {$now - $now%86400}]
clock format $cur_day_epoch -format "%m" -gmt 1

will give the correct day (month day)

Stuart

0 new messages