QNX Developer Support
|This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.|
Get the current time
#include <sys/time.h> int gettimeofday( struct timeval * when, void * not_used );
- A pointer to a timeval structure where the function
can store the time.
The struct timeval contains the following members:
- long tv_sec -- the number of seconds since the start of the Unix Epoch.
- long tv_usec -- the number of microseconds.
- This pointer must be NULL or the behavior of gettimeofday() is unspecified. This argument is provided only for backwards compatibility.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The gettimeofday() function returns the current time in when in seconds and microseconds, since the Unix Epoch, 00:00:00 January 1, 1970 Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time (GMT)).
0 for success, or -1 if an error occurs (errno is set).
- An error occurred while accessing the when buffer.
The gettimeofday() function is provided for porting existing code. You shouldn't use it in new code; use clock_gettime() instead.