diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_exchanges.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_exchanges.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c index f3603efe..accbd9c9 100644 --- a/src/backend/taler-merchant-httpd_exchanges.c +++ b/src/backend/taler-merchant-httpd_exchanges.c @@ -366,11 +366,15 @@ process_wire_fees (struct Exchange *exchange, endp = endp->next; while ( (NULL != endp) && (NULL != fees) && - (fees->start_date.abs_value_us < endp->end_date.abs_value_us) ) + (GNUNET_TIME_timestamp_cmp (fees->start_date, + <, + endp->end_date)) ) fees = fees->next; if ( (NULL != endp) && (NULL != fees) && - (fees->start_date.abs_value_us != endp->end_date.abs_value_us) ) + (GNUNET_TIME_timestamp_cmp (fees->start_date, + !=, + endp->end_date)) ) { /* Hole in the fee structure, not allowed! */ GNUNET_break_op (0); @@ -390,7 +394,7 @@ process_wire_fees (struct Exchange *exchange, "Storing wire fee for `%s' and method `%s' at %s in DB; the fee is %s\n", TALER_B2S (master_pub), wire_method, - GNUNET_STRINGS_absolute_time_to_string (af->start_date), + GNUNET_TIME_timestamp2s (af->start_date), TALER_amount2s (&af->wire_fee)); TMH_db->preflight (TMH_db->cls); if (GNUNET_OK != @@ -504,7 +508,7 @@ process_wire_accounts (struct Exchange *exchange, */ static struct FeesByWireMethod * get_wire_fees (struct Exchange *exchange, - struct GNUNET_TIME_Absolute now, + struct GNUNET_TIME_Timestamp now, const char *wire_method) { for (struct FeesByWireMethod *fbw = exchange->wire_fees_head; @@ -518,7 +522,9 @@ get_wire_fees (struct Exchange *exchange, /* Advance through list up to current time */ while ( (NULL != (af = fbw->af)) && - (now.abs_value_us >= af->end_date.abs_value_us) ) + (GNUNET_TIME_timestamp_cmp (now, + >=, + af->end_date)) ) { fbw->af = af->next; GNUNET_free (af); @@ -545,10 +551,10 @@ static bool process_find_operations (struct Exchange *exchange) { struct TMH_EXCHANGES_FindOperation *fn; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Timestamp now; bool need_wire; - now = GNUNET_TIME_absolute_get (); + now = GNUNET_TIME_timestamp_get (); need_wire = false; for (struct TMH_EXCHANGES_FindOperation *fo = exchange->fo_head; NULL != fo; @@ -583,14 +589,17 @@ process_find_operations (struct Exchange *exchange) fbw = NULL; continue; } - if (fbw->af->start_date.abs_value_us > now.abs_value_us) + if (GNUNET_TIME_timestamp_cmp (fbw->af->start_date, + >, + now)) { /* Disagreement on the current time */ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Exchange's earliest fee is %s ahead of our time. Clock skew issue?\n", - GNUNET_STRINGS_relative_time_to_string ( - GNUNET_TIME_absolute_get_remaining (fbw->af->start_date), - GNUNET_YES)); + GNUNET_TIME_relative2s ( + GNUNET_TIME_absolute_get_remaining ( + fbw->af->start_date.abs_time), + true)); fbw = NULL; continue; } @@ -902,7 +911,7 @@ keys_mgmt_cb (void *cls, enum TALER_EXCHANGE_VersionCompatibility compat) { struct Exchange *exchange = cls; - struct GNUNET_TIME_Absolute expire; + struct GNUNET_TIME_Timestamp expire; struct GNUNET_TIME_Relative delay; if ( (MHD_HTTP_OK != hr->http_status) || @@ -979,13 +988,13 @@ keys_mgmt_cb (void *cls, } } + exchange->first_retry = GNUNET_TIME_relative_to_absolute (RELOAD_DELAY); expire = TALER_EXCHANGE_check_keys_current (exchange->conn, TALER_EXCHANGE_CKF_NONE); - exchange->first_retry = GNUNET_TIME_relative_to_absolute (RELOAD_DELAY); - if (0 == expire.abs_value_us) + if (0 == GNUNET_TIME_absolute_is_zero (expire.abs_time)) delay = RELOAD_DELAY; else - delay = GNUNET_TIME_absolute_get_remaining (expire); + delay = GNUNET_TIME_absolute_get_remaining (expire.abs_time); if (GNUNET_TIME_relative_is_zero (delay)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1049,7 +1058,7 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange, { struct Exchange *exchange; struct TMH_EXCHANGES_FindOperation *fo; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Timestamp now; if (NULL == merchant_curl_ctx) { @@ -1115,8 +1124,7 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange, return fo; } - now = GNUNET_TIME_absolute_get (); - (void) GNUNET_TIME_round_abs (&now); + now = GNUNET_TIME_timestamp_get (); if ( (! exchange->pending) && ( (NULL == fo->wire_method) || (NULL != get_wire_fees (exchange, |