Can not get time function implementation in WinCE 7 project environment

Hi,

Under WinCE 7(specifically) i want to develop some application .I want to get the current systen time,representing milliseconds since epoch.But when ever i look for time functions in time.h i donot get any under the WinCE. The path that is my applicaction looking is "C:\Program Files (x86)\Windows CETools\SDKs\CaravelARM_CE7.0_SDK\Include\Armv4i ".Also i found time.h header file in WinCE 7 but it doesnot fulill my need,i think it is a depricated one .Can you please suggest somr time function which are available in WinCE 7…

Thanks &Regards,

Shantanu K. Pradhan.

the time function is not included in Windows CE.

you can try something like this:

time_t time(time_t* pTime)
{
  SYSTEMTIME systemTime = { 0 };
  FILETIME fileTime = { 0 };
  time_t result = 0;
  GetSystemTime(&systemTime);
  if (SystemTimeToFileTime(&systemTime, &fileTime))
  {
    ULONGLONG temp = 0;
    memcpy(&temp, &fileTime, sizeof(FILETIME));
    temp -= 116444736000000000; // subtract 1970-01-01 00:00 (UTC)
    temp /= 10000000; // convert to seconds
    result = (time_t)temp;
    if (pTime != NULL)
    {
      *pTime = result;
    }
  }
  return result;
}

or, if you prefer a one liner:

time_t now = CTime::GetCurrentTime().GetTime();