1b661 Question about 'clock format' command - The Tcl programming language
Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Question about 'clock format' command

Posted by Dimon (Dimon), 22 February 2006
A short simple console snapshot:

Code:
set starttime [clock seconds]
1140615322

set endtime [clock seconds]
1140615374

set aTime [expr $endtime - $starttime]
52

clock format $aTime -format %T
02:00:52


The question is next: I recieved 52 seconds but after convertion it into format: %T (HH:MM:SS), I saw 2 hours and 52 seconds. Hm... Where is the error and how can I fix it?

Posted by admin (Graham Ellis), 23 February 2006
Clock format gives you a time from midnight, GMT, 1st January 1970. So if you subtract 2 times and try to use it to format that time, it will ONLY work if the computer is in a GMT timezone.

To solve your problem, move to England  

Posted by Dimon (Dimon), 1 March 2006
Oh, Graham, greate thanks for your invitation  
But I have solve that problem after I found a -gmt key of clock command. The string:
Code:
clock format $aTime -format %T -gmt 1

formats a time according to my computer's clock



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2013: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho
0