mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 08:54:38 +09:00
fixup! 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:
@@ -21,6 +21,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <winpr/environment.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/timezone.h>
|
||||
#include <winpr/crt.h>
|
||||
@@ -284,15 +285,21 @@ static TIME_ZONE_ENTRY* winpr_detect_windows_time_zone(void)
|
||||
{
|
||||
size_t i, j;
|
||||
char* tzid = NULL;
|
||||
LPCSTR tz = "TZ";
|
||||
|
||||
char* tzenv = getenv("TZ");
|
||||
if (tzenv) {
|
||||
tzid = strdup(tzenv);
|
||||
DWORD nSize = GetEnvironmentVariableA(tz, NULL, 0);
|
||||
if (nSize)
|
||||
{
|
||||
tzid = (char*)malloc(nSize);
|
||||
if (!GetEnvironmentVariableA(tz, tzid, nSize))
|
||||
{
|
||||
free(tzid);
|
||||
tzid = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (tzid == NULL) {
|
||||
if (tzid == NULL)
|
||||
tzid = winpr_get_unix_timezone_identifier_from_file();
|
||||
}
|
||||
|
||||
if (tzid == NULL)
|
||||
tzid = winpr_get_timezone_from_link();
|
||||
|
||||
Reference in New Issue
Block a user