Search code examples
windows-mobiletimegprs

Get time zone or local time from cell tower (GPRS)


I have been asked to set the system time of a Windows Mobile 6.0 handheld to the "local time." The local time in this case means the current time of the time zone the handheld is physically located in. Is there a way to request the local time from the GPRS cell tower?


Solution

  • You can use the RIL API

    HRESULT RIL_GetSystemTime(HRIL hRil);
    

    This returns you an HRESULT that, if positive, will identify a SYSTEMTIME structure returned on the notify thread in the lpData parameter.

    The caveat I should give is that not all networks transmit the local time, so this is not guaranteed to work.

    Many Windows Mobile devices have a settings option to synchronize the time to network time if it is transmitted, so you may want to try this if it is available on your device.