Version 3 of clock clicks

Updated 2008-05-24 15:04:18 by jscottb

clock clicks ?-option?

clock clicks returns a high-resolution time value as a system-dependent integer value. See the clock reference page for more detail.

If -milliseconds is provided as an option, then the command is synonomous with clock milliseconds. This usage is OBSOLETE.

If -microseconds is provided as an option, then the command is synonomous with clock microseconds. This usage is OBSOLETE.

In Classic MacOS, the clicks were typically as long as 1/60 second, but in recent MacOS X, they are instead so fast that

  expr {[clock clicks] == [clock clicks]}

never seems to return true (more than µs resolution). Other platforms still have had clicks = milliseconds, and this assumption is sometimes made in Tcl code.

In other words, the uniqueness of this value is notoriously unreliable, especially for cross-platform comparisons. An alternative source when generating unique IDs (cf. GUID and UUID) is to use info cmdcount.

Scott Beasley

I feel that info cmdcount is totally useless for Unique key generation. It stays very small in size for too long and changes at a MUCH lower rate then does clock clicks in a modern tcl (8.4-8.5) system. Not saying it couldn't be used as an "enhancement" number though in the generation process.