Skip to content
Snippets Groups Projects
Commit 1d43b963 authored by sbbs's avatar sbbs
Browse files

Bug-fix: xpTimeZone_local() returned the UTC-offset as they daylight saving

time was in effect, year-round, on Linux.

Use the localtime() tm_gmtoff method of detecting the local time zone offset
on Linux, don't rely on the global variables 'timezone' and 'daylight'
behaving as they did in Borland C/DOS. From the Linux man page:
 Note that the variable daylight does not indicate that daylight  saving
       time  applies  right now.
parent bc1d0100
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,7 @@ xpDateTime_t DLLCALL xpDateTime_now(void) ...@@ -87,7 +87,7 @@ xpDateTime_t DLLCALL xpDateTime_now(void)
/* Return local timezone offset (in minutes) */ /* Return local timezone offset (in minutes) */
xpTimeZone_t DLLCALL xpTimeZone_local(void) xpTimeZone_t DLLCALL xpTimeZone_local(void)
{ {
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DARWIN__) #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DARWIN__) || defined(__linux__)
struct tm tm; struct tm tm;
time_t t; time_t t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment