The clock Command

The clock command has facilities for getting the current time, formatting time values, and scanning printed time strings to get an integer time value. The clock command was added in Tcl 7.5. Table 13-1 summarizes the clock command:

Table 13-1. The clock command.
clock clicksA system-dependent high resolution counter.
clock format value ?-format str?Formats a clock value according to str.
clock scan string ?-base clock? ?-gmt boolean?Parses date string and return seconds value. The clock value determines the date.
clock secondsReturns the current time in seconds.

The following command prints the current time:

clock format [clock seconds]
=> Sun Nov 24 14:57:04  1996
					

The clock seconds command returns the current time, in seconds ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.