-display expiration times with records
authorChristian Grothoff <christian@grothoff.org>
Fri, 29 Jun 2012 22:12:43 +0000 (22:12 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 29 Jun 2012 22:12:43 +0000 (22:12 +0000)
src/namestore/gnunet-namestore.c

index 27978be0367389b42dd8cbda502c5c38535c46ef..9859688dd45f92d8cbf29e11a1c753318fda6caa 100644 (file)
@@ -236,6 +236,9 @@ display_record (void *cls,
   const char *typestring;
   char *s;
   unsigned int i;
+  char *etime;
+  struct GNUNET_TIME_Absolute aex;
+  struct GNUNET_TIME_Relative rex;
 
   if (NULL == name)
   {
@@ -260,7 +263,22 @@ display_record (void *cls,
               (unsigned int) rd[i].record_type);
       continue;
     }
-    FPRINTF (stdout, "\t%s: %s\n", typestring, s);
+    if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+    {
+      rex.rel_value = rd[i].expiration_time;
+      etime = GNUNET_STRINGS_relative_time_to_string (rex);
+    }
+    else
+    {
+      aex.abs_value = rd[i].expiration_time;
+      etime = GNUNET_STRINGS_absolute_time_to_string (aex);
+    }
+    FPRINTF (stdout, "\t%s: %s (%s %s)\n", typestring, s, 
+            (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) 
+            ? _(/* what follows is relative expiration */ "for at least")
+            : _(/* what follows is absolute expiration */ "until"),
+            etime);
+    GNUNET_free (etime);
     GNUNET_free (s);    
   }
   FPRINTF (stdout, "%s", "\n");