summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_trait_time.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-05 20:43:28 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-05 20:43:28 +0200
commit6de49ea2c02e311e5f5366005bd3497a9bb25187 (patch)
treea221b9c784b4e004eb5972e18516653d1aea6a5c /src/testing/testing_api_trait_time.c
parente428783e2e0295186dc4eae273df8a3f8b75df60 (diff)
parented5b98a2c2308fbd44b906a30286d2689fd304dd (diff)
downloadexchange-6de49ea2c02e311e5f5366005bd3497a9bb25187.tar.gz
exchange-6de49ea2c02e311e5f5366005bd3497a9bb25187.tar.bz2
exchange-6de49ea2c02e311e5f5366005bd3497a9bb25187.zip
Merge branch 'protocolv8'
Diffstat (limited to 'src/testing/testing_api_trait_time.c')
-rw-r--r--src/testing/testing_api_trait_time.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_time.c b/src/testing/testing_api_trait_time.c
index c77489bfa..207246bed 100644
--- a/src/testing/testing_api_trait_time.c
+++ b/src/testing/testing_api_trait_time.c
@@ -29,6 +29,7 @@
#include "taler_testing_lib.h"
#define TALER_TESTING_TRAIT_TIME_ABS "time-abs"
+#define TALER_TESTING_TRAIT_TIME_REL "time-rel"
/**
* Obtain a absolute time from @a cmd.
@@ -73,4 +74,47 @@ TALER_TESTING_make_trait_absolute_time
}
+/**
+ * Obtain a relative time from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which time to pick if
+ * @a cmd has multiple on offer.
+ * @param[out] time set to the wanted WTID.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_relative_time (
+ const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const struct GNUNET_TIME_Relative **time)
+{
+ return cmd->traits (cmd->cls,
+ (const void **) time,
+ TALER_TESTING_TRAIT_TIME_REL,
+ index);
+}
+
+
+/**
+ * Offer a relative time.
+ *
+ * @param index associate the object with this index
+ * @param time which object should be returned
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_relative_time (
+ unsigned int index,
+ const struct GNUNET_TIME_Relative *time)
+{
+ struct TALER_TESTING_Trait ret = {
+ .index = index,
+ .trait_name = TALER_TESTING_TRAIT_TIME_REL,
+ .ptr = (const void *) time
+ };
+ return ret;
+}
+
+
/* end of testing_api_trait_time.c */