1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-30 05:40:06 +00:00

Apply patch submitted upstream to better emulate the USG UNIX

daylight global variable as implemented in glibc.

Obtained from:	https://github.com/Gnucash/gnucash/pull/116
This commit is contained in:
Guido Falsi 2017-07-31 15:07:02 +00:00
parent 740d6d61f5
commit 83c10ee61d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=446961
2 changed files with 18 additions and 3 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= gnucash
PORTVERSION= 2.6.17
PORTREVISION= 1
CATEGORIES= finance gnome
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20%28stable%29/${PORTVERSION}

View File

@ -1,12 +1,26 @@
--- src/import-export/ofx/gnc-ofx-import.c.orig 2016-12-15 21:46:51 UTC
+++ src/import-export/ofx/gnc-ofx-import.c
@@ -337,7 +337,11 @@ fix_ofx_bug_39 (time64 t)
@@ -336,8 +336,25 @@ fix_ofx_bug_39 (time64 t)
{
#if HAVE_OFX_BUG_39
struct tm stm;
gnc_localtime_r(&t, &stm);
+
+#ifdef __FreeBSD__
+ if (!stm.tm_isdst)
+ time64 now;
+ /*
+ * FreeBSD has it's own libc implementation which differs from glibc. In particular:
+ * There is no daylight global
+ * tzname members are set to the string " " (three spaces) when not explicitly populated
+ *
+ * To check that the current timezone does not observe DST I check if tzname[1] starts with a space.
+ */
+ now = gnc_time (NULL);
+ gnc_localtime_r(&now, &stm);
+ tzset();
+
+ if (tzname[1][0] != ' ' && !stm.tm_isdst)
+#else
gnc_localtime_r(&t, &stm);
if (daylight && !stm.tm_isdst)
+#endif
t += 3600;