Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone settings #10131

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions client/common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -4609,6 +4609,22 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
if (!freerdp_settings_set_uint32(settings, FreeRDP_TcpAckTimeout, (UINT32)val))
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
CommandLineSwitchCase(arg, "timezone")
{
TIME_ZONE_INFORMATION* ctz = winpr_GetWindowsTimezoneFromIANA(arg->Value);
if (!ctz)
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;

TIME_ZONE_INFORMATION* tz =
freerdp_settings_get_pointer_writable(settings, FreeRDP_ClientTimeZone);
if (!tz)
{
free(ctz);
return COMMAND_LINE_ERROR_MEMORY;
}
*tz = *ctz;
free(ctz);
}
CommandLineSwitchCase(arg, "aero")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_AllowDesktopComposition, enable))
Expand Down
2 changes: 2 additions & 0 deletions client/common/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
{ "timeout", COMMAND_LINE_VALUE_REQUIRED, "<time in ms>", "9000", NULL, -1, "timeout",
"Advanced setting for high latency links: Adjust connection timeout, use if you encounter "
"timeout failures with your connection" },
{ "timezone", COMMAND_LINE_VALUE_REQUIRED, "<IANA timezone>", NULL, NULL, -1, NULL,
"Use supplied IANA timezone for connection (requires server support)" },
{ "tls", COMMAND_LINE_VALUE_REQUIRED, "[ciphers|seclevel|secrets-file|enforce]", NULL, NULL, -1,
NULL,
"TLS configuration options:"
Expand Down
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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: call to undeclared function 'tz_map_iana_to_windows'; ISO C99 and later do not support implicit function declarations [clang-diagnostic-implicit-function-declaration]

	WCHAR* wzid = tz_map_iana_to_windows(tzid);
               ^

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: incompatible integer to pointer conversion initializing 'WCHAR *' (aka 'unsigned short *') with an expression of type 'int' [clang-diagnostic-int-conversion]

	WCHAR* wzid = tz_map_iana_to_windows(tzid);
        ^

if (!wzid)
return NULL;

TIME_ZONE_INFORMATION* entry = winpr_get_from_id(tzid, wzid);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: call to undeclared function 'winpr_get_from_id'; ISO C99 and later do not support implicit function declarations [clang-diagnostic-implicit-function-declaration]

	TIME_ZONE_INFORMATION* entry = winpr_get_from_id(tzid, wzid);
                                ^

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: incompatible integer to pointer conversion initializing 'TIME_ZONE_INFORMATION *' with an expression of type 'int' [clang-diagnostic-int-conversion]

	TIME_ZONE_INFORMATION* entry = winpr_get_from_id(tzid, wzid);
                        ^

free(wzid);
return entry;
}
Loading