dwContext_getCurrentTime() returns CLOCK_REALTIME timestamps

Hardware Platform: DRIVE AGX Xavier™ Developer Kit
Software Version: DRIVE Software 10

dwContext_getCurrentTime() documentation says:

Timestamps from the same context are guaranteed to be in sync. The returned time represents the absolute time as received through system time source. On POSIX based systems, the time is measured using CLOCK_MONOTONIC time source.

However, in my experimentation timestamps returned by dwContext_getCurrentTime() match those of CLOCK_REALTIME. Is this a documentation error?

Dear @raul.tambre,
How did you verify it. Can you provide some snippet for verify it on my host.

Here’s a small example:

#include <dw/core/Context.h>
#include <dw/core/VersionCurrent.h>
#include <time.h>

#include <cassert>
#include <cstdio>

int main()
	dwContextHandle_t context;
	dwInitialize(&context, DW_VERSION, nullptr);

	timespec monotonic;
	assert(clock_gettime(CLOCK_MONOTONIC, &monotonic) == 0);

	dwTime_t time;
	dwContext_getCurrentTime(&time, context);

	timespec realtime;
	assert(clock_gettime(CLOCK_REALTIME, &realtime) == 0);

	std::printf("CLOCK_MONOTONIC: %ld\nCLOCK_REALTIME: %ld\nDriveWorks: %ld\n", monotonic.tv_sec, realtime.tv_sec, time / 1000000);

Output on my developer kit:

CLOCK_REALTIME: 1593407856
DriveWorks: 1593407856

Dear @raul.tambre,
I could reproduce the issue. It is looking like a documentation issue. Thank you for bringing it to our attention. We will fix this.

1 Like