aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/strings.c11
-rw-r--r--src/util/test_strings.c21
2 files changed, 19 insertions, 13 deletions
diff --git a/src/util/strings.c b/src/util/strings.c
index f526dd35a..c7eda9ad9 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -367,17 +367,6 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
367 return GNUNET_SYSERR; 367 return GNUNET_SYSERR;
368 t = mktime (&tv); 368 t = mktime (&tv);
369 atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL); 369 atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL);
370#if WINDOWS
371 {
372 DWORD tzv;
373 TIME_ZONE_INFORMATION tzi;
374 tzv = GetTimeZoneInformation (&tzi);
375 if (TIME_ZONE_ID_INVALID != tzv)
376 {
377 atime->abs_value_us -= 1000LL * 1000LL * tzi.Bias * 60LL;
378 }
379 }
380#endif
381 return GNUNET_OK; 370 return GNUNET_OK;
382} 371}
383 372
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
index 839b81c04..41a602b6e 100644
--- a/src/util/test_strings.c
+++ b/src/util/test_strings.c
@@ -108,9 +108,26 @@ main (int argc, char *argv[])
108 108
109 at.abs_value_us = 50000000000; 109 at.abs_value_us = 50000000000;
110 bc = GNUNET_STRINGS_absolute_time_to_string (at); 110 bc = GNUNET_STRINGS_absolute_time_to_string (at);
111
111 GNUNET_assert (GNUNET_OK == 112 GNUNET_assert (GNUNET_OK ==
112 GNUNET_STRINGS_fancy_time_to_absolute (bc, &atx)); 113 GNUNET_STRINGS_fancy_time_to_absolute (bc, &atx));
113 GNUNET_assert (atx.abs_value_us == at.abs_value_us); 114
115 if (atx.abs_value_us != at.abs_value_us)
116 {
117#ifdef WINDOWS
118 DWORD tzv;
119 TIME_ZONE_INFORMATION tzi;
120 tzv = GetTimeZoneInformation (&tzi);
121 if (TIME_ZONE_ID_INVALID != tzv)
122 {
123 atx.abs_value_us -= 1000LL * 1000LL * tzi.Bias * 60LL;
124 }
125 if (atx.abs_value_us == at.abs_value_us)
126 fprintf (stderr,
127 "WARNING: GNUNET_STRINGS_fancy_time_to_absolute() miscalculates timezone!\n");
128#endif
129 GNUNET_assert (0);
130 }
114 131
115 GNUNET_log_skip (2, GNUNET_NO); 132 GNUNET_log_skip (2, GNUNET_NO);
116 b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown"); 133 b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown");