clock scan

From: wai shun au (wshunau_at_integ.com)
Date: 02/11/05


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"} ........."?