r23106 - gnucash/trunk/src/libqof/qof - Bug #704185: GnuCash 2.5 doesn't build on FreeBSD

John Ralls jralls at code.gnucash.org
Sun Jul 14 13:10:05 EDT 2013


Author: jralls
Date: 2013-07-14 13:10:03 -0400 (Sun, 14 Jul 2013)
New Revision: 23106
Trac: http://svn.gnucash.org/trac/changeset/23106

Modified:
   gnucash/trunk/src/libqof/qof/gnc-date.c
   gnucash/trunk/src/libqof/qof/test/test-gnc-date.c
Log:
Bug #704185: GnuCash 2.5 doesn't build on FreeBSD

Undefined symbols 'timezone' and 'daylight'
These are declared extern globals in time.h on most Unices, but not
on some BSDs. Since they're not used anywhere in Gnucash, just delete
setting them.

Modified: gnucash/trunk/src/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.c	2013-07-10 18:19:08 UTC (rev 23105)
+++ gnucash/trunk/src/libqof/qof/gnc-date.c	2013-07-14 17:10:03 UTC (rev 23106)
@@ -299,6 +299,11 @@
      return time;
 }
 
+/* Linux, Darwin, and MSWindows implementations of this function set the
+ * globals timezone and daylight; BSD doesn't have those globals, and
+ * Gnucash never uses them, so they're ommitted from this
+ * implementation. Bug 704185.
+ */
 struct tm*
 gnc_localtime_r (const time64 *secs, struct tm* time)
 {
@@ -307,16 +312,14 @@
      g_return_val_if_fail (gdt != NULL, NULL);
 
      gnc_g_date_time_fill_struct_tm (gdt, time);
-     timezone = - g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
      if (g_date_time_is_daylight_savings (gdt))
      {
 	  index = 1;
-	  daylight = 1;
           time->tm_isdst = 1;
      }
 
 #ifdef HAVE_STRUCT_TM_GMTOFF
-     time->tm_gmtoff = - timezone;
+     time->tm_gmtoff = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
 #endif
 
      g_date_time_unref (gdt);

Modified: gnucash/trunk/src/libqof/qof/test/test-gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/test/test-gnc-date.c	2013-07-10 18:19:08 UTC (rev 23105)
+++ gnucash/trunk/src/libqof/qof/test/test-gnc-date.c	2013-07-14 17:10:03 UTC (rev 23106)
@@ -93,7 +93,6 @@
 	else
 	    g_assert_cmpint (time->tm_isdst, ==, 0);
 #ifdef HAVE_STRUCT_TM_GMTOFF
-	g_assert_cmpint (time->tm_gmtoff, ==, - timezone);
 	g_assert_cmpint (time->tm_gmtoff, ==,
 	    g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND);
 #endif



More information about the gnucash-changes mailing list