OEMGetRealTime (Windows Embedded CE 6.0)

1/5/2010

This function is called by the kernel to retrieve the time from the real-time clock.

Syntax

BOOL OEMGetRealTime(
  LPSYSTEMTIME lpst 
);

Parameters

  • lpst
    [out] Pointer to the SYSTEMTIME structure that contains the current time.

Return Value

If this function succeeds, it returns TRUE.

If this function fails, it returns FALSE.

Remarks

This function must be re–entrant and, thus, must protect the hardware from being accessed multiple times.

In the OAL code, store the year value so it supports a 100-year range; for example, 1950–2050.

OEMGetRealTime is called by GetSystemTime when the clock is running in hardware mode. In hardware mode, OEMGetRealTime queries the RTC. Alternatively, you can run the clock in software mode by setting a registry key. In software mode, a clock is simulated in software based on GetTickCount, which tracks clock ticks using the timer. To specify software mode for the clock, set HKEY_LOCAL_MACHINE\Platform\"SoftRTC" = 1. This registry key must be set at boot time to have any effect.

This function should not return a year earlier than 1601.

Code Example

Ee478533.collapse(en-US,WinEmbedded.60).gifDescription

The following code example shows how to make this function re-entrant. For more details, see Rtc.c in the %_WINCEROOT%\Platform\common\src\x86\common\rtc directory.

Ee478533.collapse(en-US,WinEmbedded.60).gifCode

BOOL OEMGetRealTime ( __out LPSYSTEMTIME lpst)
{
    BOOL RetVal;
    EnterCriticalSection(&RTC_critsect);
    // Code to get the time
    RetVal = Bare_GetRealTime(lpst);
    LeaveCriticalSection(&RTC_critsect);

    return RetVal;
}

Requirements

Header nkintr.h
Library OEMMain.lib or OEMMain_StaticKITL.lib
Windows Embedded CE Windows CE 2.10 and later

See Also

Tasks

Implementing the OEMPlatformInit Function

Reference

Required OAL Functions
OEMIdle
OEMSetAlarmTime

Other Resources

SetSystemTime
SYSTEMTIME