]> 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:41 +0000 (09:09 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Mon, 19 Nov 2012 08:09:41 +0000 (09:09 +0100)
configure.ac
src/rrd_restore.c

index ab210d156016adc72dcde0ee5b69c7e54bff9219..2f9e3953097b431203f9ec06d5dfa6779500513b 100644 (file)
@@ -479,23 +479,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 39148e89e80dc490bfd2ab946b91029d02448fba..9a46d04ab22ff176f75ff0249eb1e3b33306e8ad 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",