gettimeofday() and settimeofday(): Why they are not in the d

What was wrong with them in the previous versions of QNX? Why did some older ports from UNIX to QNX contain a replacement?

For example, this comes with ntp v1 port:


  • Supporting routines not available, or broken, under QNX.

#include <stdio.h>
#include <sys/time.h>
#include <sys/timers.h>

int gettimeofday(tp, tzp)
struct timeval *tp;
struct timezone *tzp;
int status;
struct timespec dtm;

if ((status = clock_gettime(CLOCK_REALTIME, &dtm)) == 0) {

tp->tv_sec = dtm.tv_sec;
tp->tv_usec = dtm.tv_nsec / 1000L;

if (tzp != NULL) {
tzp->tz_minuteswest = 0;
tzp->tz_dsttime = 0;
return status;

int settimeofday(tp, tzp)
const struct timeval *tp;
const struct timezone *tzp;
struct timespec dtm;

dtm.tv_sec = tp->tv_sec;
dtm.tv_nsec = tp->tv_usec * 1000L;

return clock_settime(CLOCK_REALTIME, &dtm);

I do not know the version QNX was then, but now QNX v4.25G and Watcom C v10.6B compile and (seemingly) work without including theese sources.

Neither is prototyped in the Watcom’s documentation, why?
Should I still include the code shown or I may safely rely on the Watcom C v10.6B libraryes?