]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
properly fix handling of time_t size in rrd_restore
authorTobias Oetiker <tobi@oetiker.ch>
Mon, 19 Nov 2012 08:09:15 +0000 (09:09 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Mon, 19 Nov 2012 08:09:15 +0000 (09:09 +0100)
configure.ac
src/rrd_restore.c

index a1b6c5829473d365828ae93a86b218cf6e4f5544..7d81fe07ff77d2a69165c8a771e8976372206b87 100644 (file)
@@ -478,23 +478,10 @@ AC_LINK_IFELSE(
       )
     ]  
 )
+AC_LANG_POP(C)
 
 dnl is time_t 32 of 64 bit ?
-AC_DEFINE([TIME_T_IS_32BIT], [], [time_t is 32bit])
-AC_DEFINE([TIME_T_IS_64BIT], [], [time_t is 64bit])
-AC_MSG_CHECKING([the type of time_t])
 AC_CHECK_SIZEOF([time_t])
-if test "x$ac_cv_sizeof_time_t" = "x4"; then
-  AC_MSG_RESULT([time_t is 32 bit])
-  AC_DEFINE([TIME_T_IS_32BIT])
-elif test "x$ac_cv_sizeof_time_t" = "x8"; then
-  AC_MSG_RESULT([time_t is 64 bit])
-  AC_DEFINE([TIME_T_IS_64BIT])
-else
-  AC_MSG_ERROR([can not figure type of time_t])
-fi
-
-AC_LANG_POP(C)
 
 CONFIGURE_PART(Find 3rd-Party Libraries)
 
index 61174e3e1058912004bea49f513275d890479d55..c7decec04a11c2735ff3486893e7b7ea234ad3ca 100644 (file)
@@ -227,18 +227,12 @@ static int get_xml_time_t(
     time_t temp;    
     if ((text = get_xml_text(reader)) != NULL){
         errno = 0;        
-#ifdef TIME_T_IS_32BIT
+#if SIZEOF_TIME_T == 4
         temp = strtol((char *)text,NULL, 0);
-#else
-#ifdef TIME_T_IS_64BIT
+#elif SIZEOF_TIME_T == 8
         temp = strtoll((char *)text,NULL, 0);        
 #else
-        if (sizeof(time_t) == 4){
-            temp = strtol((char *)text,NULL, 0);
-        } else {
-            temp = strtoll((char *)text,NULL, 0);
-        }
-#endif
+#error "Don't know how to deal with TIME_T other than 4 or 8 bytes"
 #endif    
         if (errno>0){
             rrd_set_error("ling %d: get_xml_time_t from '%s' %s",