Name

cyg_clock_set_systime() — Sets the system clock to the supplied time

Synopsis

#include <cyg/clock/api.h>

Cyg_ErrNo cyg_clock_set_systime(const struct timespec *ts);

Description

Sets the system time to the time represented in the struct timespec at ts. The time is treated as a UTC offset from the Epoch, defined as 1970-01-01 00:00:00 UTC for consistency with POSIX.

Upon setting, the clock management thread will wake up and notify any modules which registered for notifications of time changes. If CYGSEM_CLOCK_COMMON_ALWAYS_UPDATE_WALLCLOCK is enabled, it will also update the wallclock device.

[Note]Note

If another thread attempts to set the time before the previous time setting has been processed by the clock management thread (including notifications and updating wallclock), it will be forced to block and wait for the previous set operation to complete. This may also occur if the clock management thread is busy updating the wallclock in response to a periodic request as configured by CYGNUM_CLOCK_COMMON_WALLCLOCK_UPDATE_PERIOD.

Return value

This function returns a standard error code, as defined in <errno.h>, or ENOERR on success.