Phil, Yes, I know this was committed a year ago, but I'm sitting at 34,000 feet and finally found time to go through the set of changes over the past... year..
Anyways, this change seems wrong to me. The main difference between gmtime() and gmtime_r() is that the latter is thread-safe whereas the former is not. If Win32 doesn't have gmtime_r the proper fix would be to use AC_REPLACE_FUNCS() and create an implementation of gmtime_r() that we can use for systems (like Win32) that don't have it. This would imply: 1) add gmtime_r to the AC_REPLACE_FUNCS in configure.in 2) create an implementation of gmtime_r in lib/libc/ 3) hook that together in lib/libc/Makefile.am Maybe you just don't care about thread safety in gnc-backend-sql.c? -derek Phil Longstaff <[email protected]> writes: > Author: plongstaff > Date: 2008-07-13 23:05:24 -0400 (Sun, 13 Jul 2008) > New Revision: 17325 > Trac: http://svn.gnucash.org/trac/changeset/17325 > > Modified: > gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c > Log: > Replace gmtime_r() with gmtime() so that it can be compiled on win32. > > > > Modified: gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c > =================================================================== > --- gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c > 2008-07-13 21:28:45 UTC (rev 17324) > +++ gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c > 2008-07-14 03:05:24 UTC (rev 17325) > @@ -1518,7 +1518,7 @@ > Timespec ts; > gchar* datebuf; > time_t time; > - struct tm tm; > + struct tm* tm; > gint year; > GValue* value; > > @@ -1533,13 +1533,13 @@ > ts = (*ts_getter)( pObject ); > > time = timespecToTime_t( ts ); > - (void)gmtime_r( &time, &tm ); > + tm = gmtime( &time ); > > - if( tm.tm_year < 60 ) year = tm.tm_year + 2000; > - else year = tm.tm_year + 1900; > + if( tm->tm_year < 60 ) year = tm->tm_year + 2000; > + else year = tm->tm_year + 1900; > > datebuf = g_strdup_printf( TIMESPEC_STR_FORMAT, > - year, tm.tm_mon+1, tm.tm_mday, > tm.tm_hour, tm.tm_min, tm.tm_sec ); > + year, tm->tm_mon+1, tm->tm_mday, > tm->tm_hour, tm->tm_min, tm->tm_sec ); > g_value_init( value, G_TYPE_STRING ); > g_value_take_string( value, datebuf ); > > > _______________________________________________ > gnucash-changes mailing list > [email protected] > https://lists.gnucash.org/mailman/listinfo/gnucash-changes > > -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH [email protected] PGP key available _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
