Forum Discussion
I worked a case on this back in 2012 and I just dug it up to cut & paste my findings:
---START---
Furthermore, with everything 64-bit in v11 already it looks like ‘clock clicks –milliseconds’ already does what you want. So if you use v11, you have it now with no wait and no workaround.
And yet more, there is a work around to get a millisecond timestamp:
set secs [expr {wide([clock seconds])}]
set msecs [expr {($secs * 1000) + ([clock clicks -milliseconds] % 1000)}]
That should avoid the rollover issue.
Basically ‘clock clicks –milliseconds’ returns a 64-bit value, but it is being truncated – we’re only returning the rightmost 32-bits. That’s why it doesn’t look anything like 1000 * seconds. But it is the accurate 32-bit ‘tail’. So if we shift seconds to the left ( * 1000) and then add the remainder from the milliseconds (% 1000) then you should be able to recreate the accurate millisecond timestamp.
‘clock clicks –milliseconds’ is a synonym for ‘clock milliseconds’ – when the whole value is present. It is the truncation on v10 that is munging the results.
For now I’d use that work around in v10 to get milliseconds.
---END---