diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-12-14 16:04:32 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-12-14 16:04:40 +0100 |
commit | 1a1fafbd438f3f21a15c990d904e192b045d2391 (patch) | |
tree | cdd32023fd1d7c530caeae0487528d7eaac2aa29 /src/testing/testing_api_helpers_exchange.c | |
parent | bf54ee30d4727217264f470321cc2f91facf63cc (diff) | |
download | exchange-1a1fafbd438f3f21a15c990d904e192b045d2391.tar.xz |
introducing GNUNET_TIME_Timestamp, recoup now with amounts
Diffstat (limited to 'src/testing/testing_api_helpers_exchange.c')
-rw-r--r-- | src/testing/testing_api_helpers_exchange.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/testing/testing_api_helpers_exchange.c b/src/testing/testing_api_helpers_exchange.c index 0f50aabb8..fe7588107 100644 --- a/src/testing/testing_api_helpers_exchange.c +++ b/src/testing/testing_api_helpers_exchange.c @@ -422,19 +422,22 @@ const struct TALER_EXCHANGE_DenomPublicKey * TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, const struct TALER_Amount *amount) { - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Timestamp now; struct TALER_EXCHANGE_DenomPublicKey *pk; char *str; - now = GNUNET_TIME_absolute_get (); + now = GNUNET_TIME_timestamp_get (); for (unsigned int i = 0; i<keys->num_denom_keys; i++) { pk = &keys->denom_keys[i]; if ( (0 == TALER_amount_cmp (amount, &pk->value)) && - (now.abs_value_us >= pk->valid_from.abs_value_us) && - (now.abs_value_us < - pk->withdraw_valid_until.abs_value_us) ) + (GNUNET_TIME_timestamp_cmp (now, + >=, + pk->valid_from)) && + (GNUNET_TIME_timestamp_cmp (now, + <, + pk->withdraw_valid_until)) ) return pk; } /* do 2nd pass to check if expiration times are to blame for @@ -445,19 +448,21 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, pk = &keys->denom_keys[i]; if ( (0 == TALER_amount_cmp (amount, &pk->value)) && - ( (now.abs_value_us < pk->valid_from.abs_value_us) || - (now.abs_value_us > - pk->withdraw_valid_until.abs_value_us) ) ) + (GNUNET_TIME_timestamp_cmp (now, + <, + pk->valid_from) || + GNUNET_TIME_timestamp_cmp (now, + >, + pk->withdraw_valid_until) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have denomination key for `%s', but with wrong" " expiration range %llu vs [%llu,%llu)\n", str, - (unsigned long long) now.abs_value_us, - (unsigned long long) pk->valid_from.abs_value_us, - (unsigned long long) - pk->withdraw_valid_until.abs_value_us); + (unsigned long long) now.abs_time.abs_value_us, + (unsigned long long) pk->valid_from.abs_time.abs_value_us, + (unsigned long long) pk->withdraw_valid_until.abs_time.abs_value_us); GNUNET_free (str); return NULL; } |