SHUTDOWN
[oweals/gnunet.git] / src / include / gnunet_time_lib.h
index fa443a4632cff80a6914f0fd7c1a987928e5a8d4..4f0b3b74c3a3a1254b5b77230d4dbd15fd203dd1 100644 (file)
@@ -46,7 +46,7 @@ struct GNUNET_TIME_Absolute
   /**
    * The actual value.
    */
-  uint64_t value;
+  uint64_t abs_value;
 };
 
 /**
@@ -58,7 +58,7 @@ struct GNUNET_TIME_Relative
   /**
    * The actual value.
    */
-  uint64_t value;
+  uint64_t rel_value;
 };
 
 
@@ -70,7 +70,7 @@ struct GNUNET_TIME_RelativeNBO
   /**
    * The actual value (in network byte order).
    */
-  uint64_t value__ GNUNET_PACKED;
+  uint64_t rel_value__ GNUNET_PACKED;
 };
 
 
@@ -82,7 +82,7 @@ struct GNUNET_TIME_AbsoluteNBO
   /**
    * The actual value (in network byte order).
    */
-  uint64_t value__ GNUNET_PACKED;
+  uint64_t abs_value__ GNUNET_PACKED;
 };
 
 
@@ -314,6 +314,22 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add (struct
                                                       GNUNET_TIME_Relative
                                                       duration);
 
+
+/**
+ * Subtract a given relative duration from the
+ * given start time.
+ *
+ * @param start some absolute time
+ * @param duration some relative time to subtract
+ * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise
+ */
+struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_subtract (struct
+                                                          GNUNET_TIME_Absolute
+                                                          start,
+                                                          struct
+                                                          GNUNET_TIME_Relative
+                                                          duration);
+
 /**
  * Multiply relative time by a given factor.
  *
@@ -353,6 +369,17 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_add (struct
                                                       GNUNET_TIME_Relative
                                                       a2);
 
+/**
+ * Subtract relative timestamp from the other.
+ *
+ * @param a1 first timestamp
+ * @param a2 second timestamp
+ * @return ZERO if a2>=a1 (including both FOREVER), FOREVER if a1 is FOREVER, a1-a2 otherwise
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1,
+                              struct GNUNET_TIME_Relative a2);
+
 
 /**
  * Convert relative time to network byte order.