diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-12-29 21:11:00 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-12-29 21:11:00 +0000 |
commit | 2b27fe35e5674c1bb7e077cd9c294c6eb0ff425e (patch) | |
tree | 48a96dc4c7753687922ea521384aab50b6d74228 /src/util/strings.c | |
parent | 54c98ba960690442aaf982e7a39045ad42d67547 (diff) | |
download | gnunet-2b27fe35e5674c1bb7e077cd9c294c6eb0ff425e.tar.gz gnunet-2b27fe35e5674c1bb7e077cd9c294c6eb0ff425e.zip |
- fix for incorporating day light savings time
Diffstat (limited to 'src/util/strings.c')
-rw-r--r-- | src/util/strings.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/util/strings.c b/src/util/strings.c index 92e24c1b7..f526dd35a 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -347,9 +347,6 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, | |||
347 | { | 347 | { |
348 | struct tm tv; | 348 | struct tm tv; |
349 | time_t t; | 349 | time_t t; |
350 | #if HAVE_TM_GMTOFF | ||
351 | struct tm *tp; | ||
352 | #endif | ||
353 | 350 | ||
354 | if (0 == strcasecmp ("end of time", fancy_time)) | 351 | if (0 == strcasecmp ("end of time", fancy_time)) |
355 | { | 352 | { |
@@ -370,12 +367,7 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, | |||
370 | return GNUNET_SYSERR; | 367 | return GNUNET_SYSERR; |
371 | t = mktime (&tv); | 368 | t = mktime (&tv); |
372 | atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL); | 369 | atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL); |
373 | #if HAVE_TM_GMTOFF | 370 | #if WINDOWS |
374 | tp = localtime (&t); | ||
375 | atime->abs_value_us += 1000LL * 1000LL * tp->tm_gmtoff; | ||
376 | #elif defined LINUX | ||
377 | atime->abs_value_us -= 1000LL * 1000LL * timezone; | ||
378 | #elif defined WINDOWS | ||
379 | { | 371 | { |
380 | DWORD tzv; | 372 | DWORD tzv; |
381 | TIME_ZONE_INFORMATION tzi; | 373 | TIME_ZONE_INFORMATION tzi; |
@@ -744,7 +736,7 @@ GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t) | |||
744 | if (t.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) | 736 | if (t.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
745 | return _("end of time"); | 737 | return _("end of time"); |
746 | tt = t.abs_value_us / 1000LL / 1000LL; | 738 | tt = t.abs_value_us / 1000LL / 1000LL; |
747 | tp = gmtime (&tt); | 739 | tp = localtime (&tt); |
748 | /* This is hacky, but i don't know a way to detect libc character encoding. | 740 | /* This is hacky, but i don't know a way to detect libc character encoding. |
749 | * Just expect utf8 from glibc these days. | 741 | * Just expect utf8 from glibc these days. |
750 | * As for msvcrt, use the wide variant, which always returns utf16 | 742 | * As for msvcrt, use the wide variant, which always returns utf16 |