Delta Tau Forums
Time keeping - Printable Version

+- Delta Tau Forums (http://forums.deltatau.com)
+-- Forum: Delta Tau Data Systems (http://forums.deltatau.com/forumdisplay.php?fid=1)
+--- Forum: Power PMAC (http://forums.deltatau.com/forumdisplay.php?fid=2)
+--- Thread: Time keeping (/showthread.php?tid=2857)



Time keeping - khalil-yazji - 03-21-2019

Hi all

I want to get time since startup in a background C app in milliseconds.
what are the precision and drift of time functions in C like GetPmacRunTime() and GetCPUClock()?
in the manual these functions return time in seconds and microseconds respectively. However, I was testing with GetPmacRunTime(), I found that it's value has some numbers after the decimal point. Can I use this number to get time in milliseconds just by multiplying by a 1000 or do you suggest better solutions to get milliseconds?


RE: Time keeping - curtwilson - 03-22-2019

All of these functions ultimately use the CPU clock cycle counter, which increments at about 1-nanosecond intervals. They read the counter, then scale by the CPU clock frequency and rescale to the reporting units. So, yes, you can rescale to milliseconds without losing accuracy.