SmsGetTime

Send Feedback

Use this function to get an estimate of the current time approximated from the Short Message Service Center's (SMSC's) clock based on the last outgoing message that requested a status-report message and the corresponding status report message. If the last SMSC timestamp received, the system clock at the time the corresponding Short Message Service (SMS) was received, and the error margin are unknown the call to SmsGetTime will return an error.

HRESULT SmsGetTime (
SYSTEMTIME * const ptsCurrentTime,
DWORD * const pdwErrorMargin);

Parameters

  • ptsCurrentTime
    An estimate of the current time based on the most recently received SMSC timestamp (as described previously). This estimate is expressed in Universal Coordinated Time (UTC). It is up to the user to convert this time to local time if desired.
  • pdwErrorMargin
    The maximum error (expressed in seconds) of the time reported by SmsGetTime. If the error margin is unknown or could not be determined, this value is set to 0xFFFFFFFF.

Return Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    The method completed successfully.

For information about additional return values, see SMS Specific Errors and SMS General Errors.

Remarks

The SMS router maintains three variables: the last SMSC timestamp received, the system clock at the time the corresponding SMS was received, and the error margin. At startup, these values are unknown and any calls to SmsGetTime will return the SMS_E_TIMEUNAVAILABLE error.

If any SMS message is sent with a status report requested, the time the original message was sent, the timestamp of the resulting status report SMS, and the current system time are used to calculate the UTC time according to the SMSC. (Note that if the SMSC's internal time is not correct, then the estimate provided by this API will be incorrect.) Subsequent calls to the SmsGetTime API will return the UTC estimate adjusted for the time elapsed since the estimate was made.

Note that altering the system time after a timestamp has been recorded will alter the results of subsequent SmsGetTime calls.

Note   This function is not supported for CDMA.

Requirements

Smartphone: Smartphone 2002 and later
Pocket PC: Pocket PC 2002 and later
OS Versions: Windows CE 3.0 and later
Header: sms.h
Library: sms.lib

See Also

Short Message Service Functions | SmsSendMessage

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.