clock scan
From: wai shun au (wshunau_at_integ.com)
Date: 02/11/05
- Next message: 04642920123-0001_at_t-online.de: "Re: question on funny behaviour of binary scan"
- Previous message: Lord Floyd: "Re: Creating a database with MySQLTcl"
- Next in thread: Sebastian Wangnick: "Re: clock scan"
- Reply: Sebastian Wangnick: "Re: clock scan"
- Reply: Kevin Kenny: "Re: clock scan"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 11 Feb 2005 11:53:23 -0500
proc TIME2SEC {timeFormat} {
set myTimeFormat [string trim $timeFormat]
if {[regexp {([0-9][0-9][0-9][0-9])-([0-9][0-9][0-9])(
|-)([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*} $myTimeFormat allParts year jDate
separator timeString] == 1} {
set baseTime [clock scan "1/1/$year -1 days" -gmt 1]
return [clock scan "$timeString $jDate days" -base $baseTime -gmt 1]
}
return "Time format not supported"
}
###
i wrote this function to convert time to number of seconds.
on unix, TIME2SEC 2005-012-13:23:45.999 returns 1105536225, which is good
because clock format 1105536225 -gmt 1 return the same date. however, on
windows,
TIME2SEC 2005-012-13:23:45.999 returns 1105449825. clock format
1105449825 -gmt 1
gives me "jan 11" instead of "jan 12".
am i missing something? or i just have to use "if {tcl_platform(platform) ==
"unix"} ........."?
- Next message: 04642920123-0001_at_t-online.de: "Re: question on funny behaviour of binary scan"
- Previous message: Lord Floyd: "Re: Creating a database with MySQLTcl"
- Next in thread: Sebastian Wangnick: "Re: clock scan"
- Reply: Sebastian Wangnick: "Re: clock scan"
- Reply: Kevin Kenny: "Re: clock scan"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]