|
List Info
Thread: Simple timestamp
|
|
| Simple timestamp |
  United States |
2007-08-15 20:00:36 |
All
I have loaded the most current Tcl distribution from the
ActiveState
site down to a local UNIX server. The application includes a
basic
logging function which prefixes all messages sent to be
logged with a
timestamp.
e.g
proc log {
set ts [clock format [clock seconds]]
puts "$ts - $msg"
}
The problem I am having is the value returned from [clock
format [clock
seconds]] jumps all over the place. Both the time, day,
month and year
come back with inaccurate values (e.g. Thu Apr 04 14:24:38
CDT 1912).
All value are valid, just do not reflect the actual time and
date.
Running the date command on the UNIX server returns the
expected value
every time so I'm not sure why Tcl is acting the way it is.
Can someone
provides some clues?
Robert M. Bartis
Stinger Quality Assurance
TEL: (908) 582-6566
EMAIL: bartis alcatel-lucent.com
_______________________________________________
ActiveTcl mailing list
ActiveTcl listserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
|
|
|
| Re: Simple timestamp |

|
2007-08-16 10:57:49 |
|
| First
question coming to mind - Is this Tcl 8.4 or Tcl 8.5 ?
Second
question: Are the results of 'clock seconds' also all over the place, or
only the results from 'clock format' operating on
them ?
-- Andreas
Kupries
<andreask ActiveState.com>
Developer http://www.ActiveState.com
Tel: +1 778-786-1122
All
I have loaded the most
current Tcl distribution from the ActiveState site down to a local UNIX
server. The application includes a basic logging function which prefixes all
messages sent to be logged with a timestamp.
e.g
proc log
{
set ts [clock format
[clock seconds]]
puts "$ts -
$msg"
}
The problem I am having
is the value returned from [clock format [clock seconds]] jumps all over the
place. Both the time, day, month and year come back with inaccurate values
(e.g. Thu Apr 04 14:24:38 CDT 1912). All value are valid, just do not
reflect the actual time and date.
Running the date command
on the UNIX server returns the expected value every time so I'm not sure why
Tcl is acting the way it is. Can someone provides some
clues?
Robert M.
Bartis Stinger Quality Assurance TEL:
(908) 582-6566 EMAIL: alcatel-lucent.com">bartis alcatel-lucent.com
|
|
| Re: Simple timestamp |
  United States |
2007-08-16 13:18:52 |
|
| OK....now I'm very confused
I ran a short test in a separate file that prints the clock
clicks, clock seconds and [clock format [clock seconds]] every 15 secs, see
below. Everything looks fine to me. Yet when my log method runs, source shown
below, I see values jumping all over the place (as if the timestamp was coded
using [clock format [clock seconds]].
- Format seconds: Thu Aug 16 12:51:00 CDT 2007
- Clicks: -1199054231
- Seconds: 1187286675
- Format seconds: Thu Aug 16 12:51:15 CDT 2007
- Clicks: -1184044276
- Seconds: 1187286690
- Format seconds: Thu Aug 16 12:51:30 CDT 2007
- Clicks: -1169034271
- Seconds: 1187286705
- Format seconds: Thu Aug 16 12:51:45 CDT 2007
- Clicks: -1154024262
- Seconds: 1187286720
- Format seconds: Thu Aug 16 12:52:00 CDT 2007
- Clicks: -1139014257
- Seconds: 1187286735
- Format seconds: Thu Aug 16 12:52:15 CDT 2007
- Clicks: -1124004260
- Seconds: 1187286750
- Format seconds: Thu Aug 16 12:52:30 CDT 2007
- Clicks: -1108994296
- Seconds: 1187286765
- Format seconds: Thu Aug 16 12:52:45 CDT 2007
- Clicks: -1093984098
- Seconds: 1187286780
- Format seconds: Thu Aug 16 12:53:00 CDT 2007
- Clicks: -1078974266
- Seconds: 1187286795
- Format seconds: Thu Aug 16 12:53:15 CDT 2007
- Clicks: -1063964265
- Seconds: 1187286810
- Format seconds: Thu Aug 16 12:53:30 CDT 2007
- Clicks: -1048954276
- Seconds: 1187286825
- Format seconds: Thu Aug 16 12:53:45 CDT 2007
- Clicks: -1033944262
- Seconds: 1187286840
- Format seconds: Thu Aug 16 12:54:00 CDT 2007
- Clicks: -1018934263
- Seconds: 1187286855
- Format seconds: Thu Aug 16 12:54:15 CDT 2007
- Clicks: -1003924270
- Seconds: 1187286870
- Format seconds: Thu Aug 16 12:54:30 CDT 2007
- Clicks: -988914268
- Seconds: 1187286885
- Format seconds: Thu Aug 16 12:54:45 CDT 2007
- Clicks: -973904260
- Seconds: 1187286900
- Format seconds: Thu Aug 16 12:55:00 CDT 2007
- Clicks: -958894272
- Seconds: 1187286915
- Format seconds: Thu Aug 16 12:55:15 CDT 2007
- Clicks: -943884259
- Seconds: 1187286930
- Format seconds: Thu Aug 16 12:55:30 CDT 2007
- Clicks: -928874291
- Seconds: 1187286945
- Format seconds: Thu Aug 16 12:55:45 CDT 2007
- Clicks: -913864261
- Seconds: 1187286960
- Format seconds: Thu Aug 16 12:56:00 CDT 2007
#
Define common logging function to be called for all
levels private method commonLog {lvl s} { if
{[lsearch $lvls $lvl] < $lvlNum} puts
$s
set ts [clock format [clock seconds]] set s
"$ts:$name:$s" puts $fid
"$s" #
Provide means to flush file buffer each time to ensure # debug
information does not get lost if required if {$flush ==
1} { flush $fid flush
stdout } }
Robert M.
Bartis Stinger Quality Assurance TEL:
(908) 582-6566 EMAIL: alcatel-lucent.com">bartis alcatel-lucent.com
First question coming to mind - Is this Tcl 8.4 or Tcl 8.5
?
Second question: Are the results of 'clock seconds' also all over
the place, or only the results from 'clock format' operating on
them ?
-- Andreas
Kupries
<andreask ActiveState.com>
Developer http://www.ActiveState.com
Tel: +1 778-786-1122
All
I have loaded the most
current Tcl distribution from the ActiveState site down to a local UNIX
server. The application includes a basic logging function which prefixes all
messages sent to be logged with a timestamp.
e.g
proc log
{
set ts [clock
format [clock seconds]]
puts "$ts -
$msg"
}
The problem I am having
is the value returned from [clock format [clock seconds]] jumps all over the
place. Both the time, day, month and year come back with inaccurate values
(e.g. Thu Apr 04 14:24:38 CDT 1912). All value are valid, just do not
reflect the actual time and date.
Running the date
command on the UNIX server returns the expected value every time so I'm not
sure why Tcl is acting the way it is. Can someone provides some
clues?
Robert
M. Bartis Stinger Quality
Assurance TEL:
(908) 582-6566 EMAIL: alcatel-lucent.com">bartis alcatel-lucent.com
|
[1-3]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|