commit 70ef2c7616b29cbb91076ffb26148251d62eb351
parent 3044afcbbf0dbff0f0bc198aaedcb70cb4645197
Author: LRN <lrn1986@gmail.com>
Date: Tue, 8 Oct 2013 09:30:33 +0000
Update time conversion functions docs, test converting abs UTC time to string and back
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/util/strings.c b/src/util/strings.c
@@ -721,8 +721,8 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
* Note that the returned value will be overwritten if this function
* is called again.
*
- * @param t time to convert
- * @return absolute time in human-readable format
+ * @param t the absolute time to convert
+ * @return timestamp in human-readable form in local time
*/
const char *
GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t)
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
@@ -106,6 +106,12 @@ main (int argc, char *argv[])
GNUNET_STRINGS_fancy_time_to_absolute (bc, &atx));
GNUNET_assert (atx.abs_value_us == at.abs_value_us);
+ at.abs_value_us = 50000000000;
+ bc = GNUNET_STRINGS_absolute_time_to_string (at);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_STRINGS_fancy_time_to_absolute (bc, &atx));
+ GNUNET_assert (atx.abs_value_us == at.abs_value_us);
+
GNUNET_log_skip (2, GNUNET_NO);
b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown");
GNUNET_log_skip (0, GNUNET_YES);