* FreeBSD timezone detection patch

This commit is contained in:
ivan-83 2015-03-10 04:40:47 +03:00
parent e85dccc22a
commit f5dbe2c9a5

View File

@ -1498,7 +1498,9 @@ static UINT64 freerdp_windows_gmtime()
UINT64 windows_time;
time(&unix_time);
windows_time = ((UINT64) unix_time * 10000000) + 621355968000000000ULL;
windows_time = unix_time;
windows_time *= 10000000;
windows_time += 621355968000000000ULL;
return windows_time;
}
@ -1521,8 +1523,11 @@ char* freerdp_get_unix_timezone_identifier()
return tzid;
}
#ifdef __FreeBSD__
fp = fopen("/var/db/zoneinfo", "r");
#else
fp = fopen("/etc/timezone", "r");
#endif
if (fp != NULL)
{
fseek(fp, 0, SEEK_END);
@ -1678,8 +1683,10 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone)
#ifdef HAVE_TM_GMTOFF
#if defined(__FreeBSD__)
/*not the best solution, but could not get the right tyepcast*/
clientTimeZone->bias = 0;
if (local_time->tm_gmtoff >= 0)
clientTimeZone->bias = (UINT32) (local_time->tm_gmtoff / 60);
else
clientTimeZone->bias = (UINT32) (1440 + (INT32) (local_time->tm_gmtoff / 60));
#else
clientTimeZone->bias = timezone / 60;
#endif