aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac7
-rw-r--r--src/util/strings.c12
2 files changed, 16 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 4ae54482d..d901efc4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,6 +203,13 @@ AC_CHECK_LIB(socket, socket)
203AC_CHECK_LIB(m, log) 203AC_CHECK_LIB(m, log)
204AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported])) 204AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
205 205
206
207AC_CHECK_MEMBER(struct tm.tm_gmtoff,
208 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
209 [Define if struct tm has the tm_gmtoff member.])],
210 ,
211 [#include <time.h>])
212
206# 'save' libs; only those libs found so far will be 213# 'save' libs; only those libs found so far will be
207# linked against _everywhere_. For the others, we 214# linked against _everywhere_. For the others, we
208# will be more selective! 215# will be more selective!
diff --git a/src/util/strings.c b/src/util/strings.c
index 70a1160dd..d9280a37d 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -197,7 +197,7 @@ struct ConversionTable
197 * @param input input string to parse 197 * @param input input string to parse
198 * @param table table with the conversion of unit names to numbers 198 * @param table table with the conversion of unit names to numbers
199 * @param output where to store the result 199 * @param output where to store the result
200 * @return GNUNET_OK on success, GNUNET_SYSERR on error 200 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
201 */ 201 */
202static int 202static int
203convert_with_table (const char *input, 203convert_with_table (const char *input,
@@ -255,7 +255,7 @@ convert_with_table (const char *input,
255 * 255 *
256 * @param fancy_size human readable string (i.e. 1 MB) 256 * @param fancy_size human readable string (i.e. 1 MB)
257 * @param size set to the size in bytes 257 * @param size set to the size in bytes
258 * @return GNUNET_OK on success, GNUNET_SYSERR on error 258 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
259 */ 259 */
260int 260int
261GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size, 261GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size,
@@ -345,6 +345,9 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
345{ 345{
346 struct tm tv; 346 struct tm tv;
347 time_t t; 347 time_t t;
348#if HAVE_TM_GMTOFF
349 struct tm *tp;
350#endif
348 351
349 if (0 == strcasecmp ("end of time", fancy_time)) 352 if (0 == strcasecmp ("end of time", fancy_time))
350 { 353 {
@@ -365,7 +368,10 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
365 return GNUNET_SYSERR; 368 return GNUNET_SYSERR;
366 t = mktime (&tv); 369 t = mktime (&tv);
367 atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL); 370 atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL);
368#if LINUX 371#if HAVE_TM_GMTOFF
372 tp = localtime (&t);
373 atime->abs_value_us += 1000LL * 1000LL * tp->tm_gmtoff;
374#elif defined LINUX
369 atime->abs_value_us -= 1000LL * 1000LL * timezone; 375 atime->abs_value_us -= 1000LL * 1000LL * timezone;
370#elif defined WINDOWS 376#elif defined WINDOWS
371 { 377 {