[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -even more time functions
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -even more time functions |
Date: |
Fri, 23 Jul 2021 20:22:01 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 577b33663 -even more time functions
577b33663 is described below
commit 577b336638cc9616edf87cf204a853ffc4e3ab0e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jul 23 20:18:47 2021 +0200
-even more time functions
---
src/include/gnunet_time_lib.h | 18 ++++++++++++++++++
src/util/time.c | 20 ++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index ff602194c..26b442066 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -548,6 +548,24 @@ bool
GNUNET_TIME_absolute_is_never (struct GNUNET_TIME_Absolute abs);
+/**
+ * Test if @a abs is truly in the past (excluding now).
+ *
+ * @return true if it is.
+ */
+bool
+GNUNET_TIME_absolute_is_past (struct GNUNET_TIME_Absolute abs);
+
+
+/**
+ * Test if @a abs is truly in the future (excluding now).
+ *
+ * @return true if it is.
+ */
+bool
+GNUNET_TIME_absolute_is_future (struct GNUNET_TIME_Absolute abs);
+
+
/**
* Test if @a rel is forever.
*
diff --git a/src/util/time.c b/src/util/time.c
index 3ea5a1ea1..eb7bd6766 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -491,6 +491,26 @@ GNUNET_TIME_relative_is_zero (struct GNUNET_TIME_Relative
rel)
}
+bool
+GNUNET_TIME_absolute_is_past (struct GNUNET_TIME_Absolute abs)
+{
+ struct GNUNET_TIME_Absolute now;
+
+ now = GNUNET_TIME_absolute_get ();
+ return abs.abs_value_us < now.abs_value_us;
+}
+
+
+bool
+GNUNET_TIME_absolute_is_future (struct GNUNET_TIME_Absolute abs)
+{
+ struct GNUNET_TIME_Absolute now;
+
+ now = GNUNET_TIME_absolute_get ();
+ return abs.abs_value_us > now.abs_value_us;
+}
+
+
struct GNUNET_TIME_Absolute
GNUNET_TIME_absolute_from_ms (uint64_t ms_after_epoch)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -even more time functions,
gnunet <=