共用方式為


SmsGetTime

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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.

Syntax

HRESULT SmsGetTime (
    const SYSTEMTIME*  ptsCurrentTime,
    const DWORD*       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 Value

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

Header sms.h
Library sms.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also

Reference

SmsSendMessage
SmsGetTime

Concepts

Short Message Service Functions