alexbowe edited this page Sep 14, 2010 · 7 revisions
Clone this wiki locally

NOTE: Currently untested; not intended for critical use (only as a convenience).

I study at RMIT (Melbourne), which has a mixture of Solaris, Mac OS X, Linux, and Windows computer labs. Our programs are nearly always tested on Solaris, though. Sometimes we are required to provide nanosecond timings in our experiments using the (real-time) POSIX function gethrtime(). 1

Depending on which lab I work in, or if I’m working from home, I might need to comment out (or add compile guards) into my code to compile it correctly. This can make the code less readable, and can make its behavior (particularly output) on Solaris less obvious while testing on a foreign system.

Although the granularity, accuracy and any possible side effects (such as function overhead, or being affected by changing the system clock) may be different for each function, I find it helps to at least give a ball-park figure.

1 This page has information on gethrtime() and why it isn’t available on all POSIX systems