O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required