Partager via


GetTimeZoneList (Compact 2013)

3/28/2014

This function gets a list of time zone entries.

Syntax

UINT GetTimeZoneList(
  TIME_ZONE_INFORMATION_WITH_ID *rgTimeZoneList,
  UINT cTimeZoneList
);

Parameters

  • *rgTimeZoneList
    [in] Address of the time zone list.
  • UINT cTimeZoneList
    [in] The number of entries in the list.

Return Value

The number of time zone entries.

Remarks

Call this function twice. The first time you call it, use a null value for rgTimeZoneList. The function returns the number of valid time zone entries and GetLastError has value ERROR_SUCCESS.

Call this function a second time with a pointer to the buffer in which to store the time zone list.

If a non-zero pointer is passed in rgTimeZoneList, and a large enough buffer is provided through cTimeZoneList, the function copies the valid time zone entries to rgTimeZoneList, and returns the number of valid time zones copied. GetLastError has value ERROR_SUCCESS.

If a non-zero pointer is passed in rgTimeZoneList but cTimeZoneList is smaller than the actual number of entries, the function returns the number of time zone entries and GetLastError has value ERROR_INSUFFICIENT_BUFFER.

If an argument is not valid the function returns the number of valid time zone entries and the GetLastError has value ERROR_INVALID_PARAMETER.

For all other errors, such as Registry API errors, GetTimeZoneList returns 0 and GetLastError has value ERROR_GEN_FAILURE.

Note

The returned time zone list is not sorted and can be in any order.

Requirements

Header

winbase.h

Library

coredll.lib

See Also

Reference

Time Functions
GetTimeZoneInformationID
TIME_ZONE_INFORMATION_WITH_ID