gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31174 - in gnunet: . src/util


From: gnunet
Subject: [GNUnet-SVN] r31174 - in gnunet: . src/util
Date: Sun, 8 Dec 2013 20:25:46 +0100

Author: grothoff
Date: 2013-12-08 20:25:46 +0100 (Sun, 08 Dec 2013)
New Revision: 31174

Modified:
   gnunet/configure.ac
   gnunet/src/util/strings.c
Log:
-test for tm_gmtoff and use it instead of 'timezone' as suggested by GNU libc 
manual

Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2013-12-08 17:50:15 UTC (rev 31173)
+++ gnunet/configure.ac 2013-12-08 19:25:46 UTC (rev 31174)
@@ -203,6 +203,13 @@
 AC_CHECK_LIB(m, log)
 AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg 
supported]))
 
+
+AC_CHECK_MEMBER(struct tm.tm_gmtoff,
+  [AC_DEFINE(HAVE_TM_GMTOFF, 1,
+     [Define if struct tm has the tm_gmtoff member.])],
+     ,
+     [#include <time.h>])
+
 # 'save' libs; only those libs found so far will be
 # linked against _everywhere_.  For the others, we
 # will be more selective!

Modified: gnunet/src/util/strings.c
===================================================================
--- gnunet/src/util/strings.c   2013-12-08 17:50:15 UTC (rev 31173)
+++ gnunet/src/util/strings.c   2013-12-08 19:25:46 UTC (rev 31174)
@@ -197,7 +197,7 @@
  * @param input input string to parse
  * @param table table with the conversion of unit names to numbers
  * @param output where to store the result
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 static int
 convert_with_table (const char *input,
@@ -255,7 +255,7 @@
  *
  * @param fancy_size human readable string (i.e. 1 MB)
  * @param size set to the size in bytes
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
 GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size,
@@ -345,6 +345,9 @@
 {
   struct tm tv;
   time_t t;
+#if HAVE_TM_GMTOFF
+  struct tm *tp;
+#endif
 
   if (0 == strcasecmp ("end of time", fancy_time))
   {
@@ -365,7 +368,10 @@
     return GNUNET_SYSERR;
   t = mktime (&tv);
   atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL);
-#if LINUX
+#if HAVE_TM_GMTOFF
+  tp = localtime (&t);
+  atime->abs_value_us += 1000LL * 1000LL * tp->tm_gmtoff;
+#elif defined LINUX
   atime->abs_value_us -= 1000LL * 1000LL * timezone;
 #elif defined WINDOWS
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]