From: Christian Grothoff Date: Sun, 5 Nov 2017 21:12:10 +0000 (+0100) Subject: add json from abs_time_nbo X-Git-Tag: gnunet-0.11.0rc0~99^2~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5295856396dc8364bf5ba3c710fb5210c095198a;p=oweals%2Fgnunet.git add json from abs_time_nbo --- diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h index f707bb091..e38925f14 100644 --- a/src/include/gnunet_getopt_lib.h +++ b/src/include/gnunet_getopt_lib.h @@ -230,11 +230,11 @@ GNUNET_GETOPT_option_filename (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_base32_fixed_size (char shortName, - const char *name, - const char *argumentHelp, - const char *description, - void *val, - size_t val_size); + const char *name, + const char *argumentHelp, + const char *description, + void *val, + size_t val_size); /** @@ -264,9 +264,9 @@ GNUNET_GETOPT_option_base32_fixed_size (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag (char shortName, - const char *name, - const char *description, - int *val); + const char *name, + const char *description, + int *val); /** @@ -280,10 +280,10 @@ GNUNET_GETOPT_option_flag (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint (char shortName, - const char *name, - const char *argumentHelp, - const char *description, - unsigned int *val); + const char *name, + const char *argumentHelp, + const char *description, + unsigned int *val); /** @@ -297,10 +297,10 @@ GNUNET_GETOPT_option_uint (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_ulong (char shortName, - const char *name, - const char *argumentHelp, - const char *description, - unsigned long long *val); + const char *name, + const char *argumentHelp, + const char *description, + unsigned long long *val); /** @@ -315,10 +315,10 @@ GNUNET_GETOPT_option_ulong (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time (char shortName, - const char *name, - const char *argumentHelp, - const char *description, - struct GNUNET_TIME_Relative *val); + const char *name, + const char *argumentHelp, + const char *description, + struct GNUNET_TIME_Relative *val); /** @@ -333,10 +333,10 @@ GNUNET_GETOPT_option_relative_time (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_absolute_time (char shortName, - const char *name, - const char *argumentHelp, - const char *description, - struct GNUNET_TIME_Absolute *val); + const char *name, + const char *argumentHelp, + const char *description, + struct GNUNET_TIME_Absolute *val); /** @@ -350,9 +350,9 @@ GNUNET_GETOPT_option_absolute_time (char shortName, */ struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_increment_uint (char shortName, - const char *name, - const char *description, - unsigned int *val); + const char *name, + const char *description, + unsigned int *val); /** diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index f2682bea7..c12badcd9 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h @@ -342,6 +342,16 @@ json_t * GNUNET_JSON_from_time_abs (struct GNUNET_TIME_Absolute stamp); +/** + * Convert absolute timestamp to a json string. + * + * @param stamp the time stamp + * @return a json string with the timestamp in @a stamp + */ +json_t * +GNUNET_JSON_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO stamp); + + /** * Convert relative timestamp to a json string. * diff --git a/src/json/json_generator.c b/src/json/json_generator.c index e660e10c5..98f7163bc 100644 --- a/src/json/json_generator.c +++ b/src/json/json_generator.c @@ -72,6 +72,19 @@ GNUNET_JSON_from_time_abs (struct GNUNET_TIME_Absolute stamp) } +/** + * Convert absolute timestamp to a json string. + * + * @param stamp the time stamp + * @return a json string with the timestamp in @a stamp + */ +json_t * +GNUNET_JSON_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO stamp) +{ + return GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (stamp)); +} + + /** * Convert relative timestamp to a json string. *