6#include <winpr/wtypes.h>
7#include <winpr/string.h>
8#include <winpr/timezone.h>
11static BOOL test_tz(
const char* iana,
const char* expected)
13 char key[128] = WINPR_C_ARRAY_INIT;
17 if (setenv(
"TZ", iana, 1) != 0)
21 (void)GetDynamicTimeZoneInformation(&tzif);
22 if (ConvertWCharNToUtf8(tzif.TimeZoneKeyName, ARRAYSIZE(tzif.TimeZoneKeyName), key,
26 if (strcmp(key, expected) != 0)
28 (void)fprintf(stderr,
"%s: expected time zone key '%s', got '%s'\n", iana, expected, key);
35int TestTimeZoneNestedName(
int argc,
char* argv[])
42 if (!test_tz(
"America/Argentina/Salta",
"Argentina Standard Time"))
44 if (!test_tz(
"America/Indiana/Knox",
"Central Standard Time"))
46 if (!test_tz(
"America/North_Dakota/Center",
"Central Standard Time"))
49 if (!test_tz(
"Europe/Berlin",
"W. Europe Standard Time"))