Wallclock (RTC)

This package can optionally be configured to use a wallclock (RTC) device driver if configured in the system (the CYGPKG_CLOCK_COMMON_USE_WALLCLOCK CDL configuration option). If enabled, time will be retrieved from the wallclock device when the system starts, which is then used to initialize system time.

If no wallclock device is present in the configuration, then time will be initialized to a default date of 2012-01-01 00:00:00 UTC, although obviously it can then be subsequently set to the correct time by the user, or by services such as a network time client.

The user is free to trigger an update of the wallclock from the system time with the API function cyg_clock_sync_wallclock(). This will cause the clock management thread to wake up and set the wallclock time. An argument to the function indicates whether to do so synchronously (i.e. to wait for completion) or asynchronously (complete in the background).

Alternatively, CDL configuration options are provided to force the wallclock to be updated whenever time is set. However this can be expensive if time is updated frequently, which can sometimes happen, for example, with Network Time Protocol (NTP) clients.

A second alternative is also provided to periodically wake the clock management thread up regularly after a configured number of kernel ticks.

Documentation license for this page: eCosPro License