add json from abs_time_nbo
authorChristian Grothoff <christian@grothoff.org>
Sun, 5 Nov 2017 21:12:10 +0000 (22:12 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sun, 5 Nov 2017 21:12:18 +0000 (22:12 +0100)
src/include/gnunet_getopt_lib.h
src/include/gnunet_json_lib.h
src/json/json_generator.c

index f707bb0919c989571b1fc8a29f2370d0893a7ee4..e38925f147bc996e53a1d0f5774d606620c2871b 100644 (file)
@@ -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);
 
 
 /**
index f2682bea7d82506820da7e6a79b1e6af0a042d4d..c12badcd9c7eb207d3a459658d041e893e363516 100644 (file)
@@ -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.
  *
index e660e10c53b9c43014ae77d610311d57a3c4d2ec..98f7163bcc83110f4de2e43cd217fb217e747917 100644 (file)
@@ -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.
  *