# RTC_InitSWClock

## Syntax

  `#include <nitro/rtc.h>`

      RTCResult RTC_InitSWClock( void );

## Arguments

None.

## Return Values

Returns the return value from calling the `RTC_SyncSWClock` function during initialization.

## Description

Initializes the software clock. The software clock calculates the time based on the tick value that can be obtained from the `OS_GetTick` function.

The `RTC_SyncSWClock` function is called during initialization to synchronize the software and real-time clock. Following initialization, you can call the `RTC_GetSWClockTick` function to get the total number of ticks that have elapsed since midnight on January 1, 2000. Date and time data can be obtained by calling the `RTC_GetDateTimeExFromSWClock` function.

The software clock does not advance while the TWL system is in sleep mode. Calling this function will therefore add a function to the callback list to invoke `RTC_SyncSWClock` on recovery from sleep mode and re-synchronize the software clock with the real-time clock.

The `OS_InitTick` function must be called before this one to initialize ticks. Do not call this function while PXI interrupts are disabled, because it calls the `RTC_GetDateTime` function internally.

## See Also

`RTC_SyncSWClock, RTC_GetSWClockTick, RTC_GetDateTimeExFromSWClock, RTCResult`

## Revision History

2008/04/17 Initial version.

CONFIDENTIAL