Improvement: Add a way to get timezone from environment.

Firstly get timezone from environment. If not present, use file method
This commit is contained in:
ddoe 2021-07-16 09:57:23 +02:00 committed by akallabeth
parent 8e87e9d6eb
commit badc57984e

View File

@ -283,9 +283,16 @@ static BOOL winpr_match_unix_timezone_identifier_with_list(const char* tzid, con
static TIME_ZONE_ENTRY* winpr_detect_windows_time_zone(void) static TIME_ZONE_ENTRY* winpr_detect_windows_time_zone(void)
{ {
size_t i, j; size_t i, j;
char* tzid; char* tzid = NULL;
tzid = winpr_get_unix_timezone_identifier_from_file(); char* tzenv = getenv("TZ");
if (tzenv) {
tzid = strdup(tzenv);
}
if (tzid == NULL) {
tzid = winpr_get_unix_timezone_identifier_from_file();
}
if (tzid == NULL) if (tzid == NULL)
tzid = winpr_get_timezone_from_link(); tzid = winpr_get_timezone_from_link();