Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title How to set system and hardware time from code
Ref. No. QNX.000001424
Category(ies) Utilities, Development
Issue How can we set the system time and hardware time from code?




Solution Use these functions:
qnx_set_time() for system time.
qnx_setclock(),clock_gettime(), clock_settime(), clock_getres(), and clock_setres(). They deal with CLOCK_REALTIME clock_id.

Hint: Look at the rtc source code posted on QUICS for the hardware time setting.