Not quite. You'd be best advised, I think, to use the clock function, with both its scan and format options:
Code:
set a 13:55
set b 02:15
set a1 [clock scan $a]
set b1 [clock scan $b]
#now both are in internal (POSIX) time
set r1 [expr {$a1+$b1}]
set result [clock format $r1 -format %k:%M]
Sorry that isn't quite right. Since they're both converted to dates it won't work that way. You have to convert the second time, 2:15, to seconds and add that to the first:
Code:
set a 13:55
set b 02:15
set a1 [clock scan $a]
set b1 [split $b :]
set b2 [expr {[lindex $b1 0]*3600 + [lindex $b1 1]*60 + $a1}]
#now the sum is internal (POSIX) time
set result [clock format $b2 -format %k:%M]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.