mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-core: fix timezone redirection
This commit is contained in:
parent
666c732085
commit
af0cac60d8
|
@ -24,6 +24,7 @@ set(CMAKE_COLOR_MAKEFILE ON)
|
||||||
# Include cmake modules
|
# Include cmake modules
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
|
include(CheckStructHasMember)
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
|
|
||||||
|
@ -98,6 +99,8 @@ check_include_files(stdint.h HAVE_STDINT_H)
|
||||||
check_include_files(stdbool.h HAVE_STDBOOL_H)
|
check_include_files(stdbool.h HAVE_STDBOOL_H)
|
||||||
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
||||||
|
|
||||||
|
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
|
||||||
|
|
||||||
# Libraries that we have a hard dependency on
|
# Libraries that we have a hard dependency on
|
||||||
find_required_package(OpenSSL)
|
find_required_package(OpenSSL)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#cmakedefine HAVE_STDBOOL_H
|
#cmakedefine HAVE_STDBOOL_H
|
||||||
#cmakedefine HAVE_INTTYPES_H
|
#cmakedefine HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
#cmakedefine HAVE_TM_GMTOFF
|
||||||
|
|
||||||
/* Endian */
|
/* Endian */
|
||||||
#cmakedefine BIG_ENDIAN
|
#cmakedefine BIG_ENDIAN
|
||||||
|
|
||||||
|
|
|
@ -88,21 +88,21 @@ void rdp_get_client_time_zone(STREAM* s, rdpSettings* settings)
|
||||||
local_time = localtime(&t);
|
local_time = localtime(&t);
|
||||||
clientTimeZone = settings->client_time_zone;
|
clientTimeZone = settings->client_time_zone;
|
||||||
|
|
||||||
#if defined(sun)
|
#ifdef HAVE_TM_GMTOFF
|
||||||
if(local_time->tm_isdst > 0)
|
if (local_time->tm_gmtoff >= 0)
|
||||||
clientTimeZone->bias = (uint32) (altzone / 3600);
|
|
||||||
else
|
|
||||||
clientTimeZone->bias = (uint32) (timezone / 3600);
|
|
||||||
#elif defined(HAVE_TM_GMTOFF)
|
|
||||||
if(local_time->tm_gmtoff >= 0)
|
|
||||||
clientTimeZone->bias = (uint32) (local_time->tm_gmtoff / 60);
|
clientTimeZone->bias = (uint32) (local_time->tm_gmtoff / 60);
|
||||||
else
|
else
|
||||||
clientTimeZone->bias = (uint32) ((-1 * local_time->tm_gmtoff) / 60 + 720);
|
clientTimeZone->bias = (uint32) ((-1 * local_time->tm_gmtoff) / 60 + 720);
|
||||||
|
#elif sun
|
||||||
|
if (local_time->tm_isdst > 0)
|
||||||
|
clientTimeZone->bias = (uint32) (altzone / 3600);
|
||||||
|
else
|
||||||
|
clientTimeZone->bias = (uint32) (timezone / 3600);
|
||||||
#else
|
#else
|
||||||
clientTimeZone->bias = 0;
|
clientTimeZone->bias = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(local_time->tm_isdst > 0)
|
if (local_time->tm_isdst > 0)
|
||||||
{
|
{
|
||||||
clientTimeZone->standardBias = clientTimeZone->bias - 60;
|
clientTimeZone->standardBias = clientTimeZone->bias - 60;
|
||||||
clientTimeZone->daylightBias = clientTimeZone->bias;
|
clientTimeZone->daylightBias = clientTimeZone->bias;
|
||||||
|
@ -178,6 +178,19 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
|
||||||
rdp_get_client_time_zone(s, settings);
|
rdp_get_client_time_zone(s, settings);
|
||||||
clientTimeZone = settings->client_time_zone;
|
clientTimeZone = settings->client_time_zone;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* temporary fix: to be valid the time zone names need to match
|
||||||
|
* the data that can be found at the following registry location:
|
||||||
|
* HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
|
||||||
|
*
|
||||||
|
* We should extract the data out of the registry and hardcode it
|
||||||
|
* within FreeRDP. We should then be able to figure out the proper
|
||||||
|
* names to use from the standardBias and daylightBias numerical
|
||||||
|
* values which we detect.
|
||||||
|
*/
|
||||||
|
sprintf(clientTimeZone->standardName, "%s", "GMT Standard Time");
|
||||||
|
sprintf(clientTimeZone->daylightName, "%s", "GMT Daylight Time");
|
||||||
|
|
||||||
standardName = (uint8*) freerdp_uniconv_out(settings->uniconv, clientTimeZone->standardName, &length);
|
standardName = (uint8*) freerdp_uniconv_out(settings->uniconv, clientTimeZone->standardName, &length);
|
||||||
standardNameLength = length;
|
standardNameLength = length;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue