gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] 03/05: Time math macros.


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] 03/05: Time math macros.
Date: Wed, 10 Apr 2019 17:07:37 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository exchange.

commit 814522d21c320d823ccb8b8dda1acbb7ae5538a9
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Apr 9 18:12:11 2019 +0200

    Time math macros.
---
 src/bank-lib/test_bank_api_new.c       | 35 ++++++++++++++++++++++++++--------
 src/bank-lib/testing_api_cmd_history.c |  2 +-
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/src/bank-lib/test_bank_api_new.c b/src/bank-lib/test_bank_api_new.c
index bd3d9245..c35bb13b 100644
--- a/src/bank-lib/test_bank_api_new.c
+++ b/src/bank-lib/test_bank_api_new.c
@@ -40,6 +40,29 @@
 #define CONFIG_FILE "bank.conf"
 
 /**
+ * Adds to the current time.
+ *
+ * @param relative number of _seconds_ to add to the current time.
+ * @return a new absolute time, modified according to @e relative.
+ */
+#define NOWPLUSSECS(secs) \
+  GNUNET_TIME_absolute_add \
+    (now, \
+     GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
+                                    secs))
+
+/**
+ * Subtracts from the current time.
+ *
+ * @param relative number of _seconds_ to add to the current time.
+ * @return a new absolute time, modified according to @e relative.
+ */
+#define NOWMINUSSECS(secs) \
+  GNUNET_TIME_absolute_subtract \
+    (now, \
+     GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
+                                    secs))
+/**
  * Bank process.
  */
 struct GNUNET_OS_Process *bankd;
@@ -61,11 +84,12 @@ run (void *cls,
 {
   
   extern struct TALER_BANK_AuthenticationData AUTHS[];
+  struct GNUNET_TIME_Absolute now;
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Bank serves at `%s'\n",
               bank_url);
-
+  now = GNUNET_TIME_absolute_get ();
   struct TALER_TESTING_Command commands[] = {
 
     TALER_TESTING_cmd_bank_history ("history-0",
@@ -76,19 +100,14 @@ run (void *cls,
                                     NULL, /* start */
                                     5),
 
-    #if 1
-    /**
-     * Just a dummy call to check if the logic doesn't crash.
-     */
     TALER_TESTING_cmd_bank_history_range_with_dates
       ("history-0-range",
        bank_url,
        EXCHANGE_ACCOUNT_NUMBER,
        TALER_BANK_DIRECTION_BOTH,
        GNUNET_NO,
-       GNUNET_TIME_UNIT_ZERO_ABS,
-       GNUNET_TIME_UNIT_FOREVER_ABS),
-    #endif
+       NOWMINUSSECS (5),
+       NOWPLUSSECS (5)),
 
     TALER_TESTING_cmd_fakebank_transfer_with_subject
       ("deposit-1",
diff --git a/src/bank-lib/testing_api_cmd_history.c 
b/src/bank-lib/testing_api_cmd_history.c
index 3643c591..a50fd9ba 100644
--- a/src/bank-lib/testing_api_cmd_history.c
+++ b/src/bank-lib/testing_api_cmd_history.c
@@ -1150,7 +1150,7 @@ TALER_TESTING_cmd_bank_history_range_with_dates
   hs->direction = direction;
   hs->ascending = ascending;
   hs->start_date = start_date;
-  hs->end_date = start_date;
+  hs->end_date = end_date;
 
   struct TALER_TESTING_Command cmd = {
     .label = label,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]