Skip to content

Commit

Permalink
[winpr,timezone] add API to convert from IANA
Browse files Browse the repository at this point in the history
convert IANA format timezone strings to windows format.
  • Loading branch information
akallabeth committed May 13, 2024
1 parent 41d63e1 commit 768adaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions winpr/include/winpr/timezone.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ extern "C"

#endif

WINPR_API TIME_ZONE_INFORMATION* winpr_GetWindowsTimezoneFromIANA(const char* tzid);

/*
* GetDynamicTimeZoneInformation is provided by the SDK if _WIN32_WINNT >= 0x0600 in SDKs above 7.1A
* and incorrectly if _WIN32_WINNT >= 0x0501 in older SDKs
Expand Down
11 changes: 11 additions & 0 deletions winpr/libwinpr/timezone/timezone.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,3 +685,14 @@ DWORD GetDynamicTimeZoneInformationEffectiveYears(
}

#endif

TIME_ZONE_INFORMATION* winpr_GetWindowsTimezoneFromIANA(const char* tzid)
{
WCHAR* wzid = tz_map_iana_to_windows(tzid);
if (!wzid)
return NULL;

TIME_ZONE_INFORMATION* entry = winpr_get_from_id(tzid, wzid);
free(wzid);
return entry;
}

0 comments on commit 768adaf

Please sign in to comment.