I need to access the elapsed time since startup in nanoseconds from a Python program running on Mac OS X 10.6.
I use the following Carbon calls to get this in C code:
AbsoluteTime uptimeAbs = AbsoluteToNanoseconds(UpTime());
uint64_t elapsedTime = ((uint64_t)uptimeAbs.hi << 32) + uptimeAbs.lo;
Is it possible to get to these functions in Python using a Carbon or PyObjC module? I tried:
from Carbon import *
UpTime()
but got "NameError: name 'UpTime' is not defined".
How can I get access to this value from Python on OS X?