libfreerdp-core: fix timezone redirection

This commit is contained in:
Marc-André Moreau 2012-02-15 16:28:47 -05:00
parent b369a92639
commit 5d7e55fe9d
3 changed files with 26 additions and 8 deletions

View File

@ -24,6 +24,7 @@ set(CMAKE_COLOR_MAKEFILE ON)
# Include cmake modules
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckStructHasMember)
include(FindPkgConfig)
include(TestBigEndian)
@ -96,6 +97,8 @@ check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdbool.h HAVE_STDBOOL_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
find_required_package(OpenSSL)

View File

@ -18,6 +18,8 @@
#cmakedefine HAVE_STDBOOL_H
#cmakedefine HAVE_INTTYPES_H
#cmakedefine HAVE_TM_GMTOFF
/* Endian */
#cmakedefine BIG_ENDIAN

View File

@ -88,21 +88,21 @@ void rdp_get_client_time_zone(STREAM* s, rdpSettings* settings)
local_time = localtime(&t);
clientTimeZone = settings->client_time_zone;
#if defined(sun)
if(local_time->tm_isdst > 0)
clientTimeZone->bias = (uint32) (altzone / 3600);
else
clientTimeZone->bias = (uint32) (timezone / 3600);
#elif defined(HAVE_TM_GMTOFF)
if(local_time->tm_gmtoff >= 0)
#ifdef HAVE_TM_GMTOFF
if (local_time->tm_gmtoff >= 0)
clientTimeZone->bias = (uint32) (local_time->tm_gmtoff / 60);
else
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
clientTimeZone->bias = 0;
#endif
if(local_time->tm_isdst > 0)
if (local_time->tm_isdst > 0)
{
clientTimeZone->standardBias = clientTimeZone->bias - 60;
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);
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);
standardNameLength = length;