diff options
Diffstat (limited to 'src/backend/anastasis-httpd_policy_upload.c')
-rw-r--r-- | src/backend/anastasis-httpd_policy_upload.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c index 0f9d8d6..b9ab266 100644 --- a/src/backend/anastasis-httpd_policy_upload.c +++ b/src/backend/anastasis-httpd_policy_upload.c @@ -114,7 +114,7 @@ struct PolicyUploadContext * Timestamp of the order in @e payment_identifier. Used to * select the most recent unpaid offer. */ - struct GNUNET_TIME_Absolute existing_pi_timestamp; + struct GNUNET_TIME_Timestamp existing_pi_timestamp; /** * When does the operation timeout? @@ -125,13 +125,13 @@ struct PolicyUploadContext * How long must the account be valid? Determines whether we should * trigger payment, and if so how much. */ - struct GNUNET_TIME_Absolute end_date; + struct GNUNET_TIME_Timestamp end_date; /** * How long is the account already valid? * Determines how much the user needs to pay. */ - struct GNUNET_TIME_Absolute paid_until; + struct GNUNET_TIME_Timestamp paid_until; /** * Expected total upload size. @@ -475,7 +475,7 @@ check_payment_cb (void *cls, case TALER_MERCHANT_OSC_CLAIMED: break; } - if (0 != puc->existing_pi_timestamp.abs_value_us) + if (! GNUNET_TIME_absolute_is_zero (puc->existing_pi_timestamp.abs_time)) { /* repeat payment request */ GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -815,8 +815,8 @@ AH_handler_policy_post ( } else { - puc->timeout = GNUNET_TIME_relative_to_absolute - (CHECK_PAYMENT_GENERIC_TIMEOUT); + puc->timeout = GNUNET_TIME_relative_to_absolute ( + CHECK_PAYMENT_GENERIC_TIMEOUT); } } @@ -848,7 +848,7 @@ AH_handler_policy_post ( { years = 0; } - puc->end_date = GNUNET_TIME_relative_to_absolute ( + puc->end_date = GNUNET_TIME_relative_to_timestamp ( GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, years)); } @@ -860,7 +860,7 @@ AH_handler_policy_post ( { struct GNUNET_TIME_Relative rem; - rem = GNUNET_TIME_absolute_get_remaining (puc->end_date); + rem = GNUNET_TIME_absolute_get_remaining (puc->end_date.abs_time); puc->years_to_pay = rem.rel_value_us / GNUNET_TIME_UNIT_YEARS.rel_value_us; if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) @@ -943,7 +943,7 @@ AH_handler_policy_post ( GNUNET_STRINGS_relative_time_to_string (rel, GNUNET_YES), ANASTASIS_MAX_YEARS_STORAGE); - puc->paid_until = GNUNET_TIME_relative_to_absolute (rel); + puc->paid_until = GNUNET_TIME_relative_to_timestamp (rel); qs = db->update_lifetime (db->cls, account_pub, &puc->payment_identifier, @@ -964,7 +964,7 @@ AH_handler_policy_post ( struct GNUNET_HashCode hc; enum ANASTASIS_DB_AccountStatus as; uint32_t version; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Timestamp now; struct GNUNET_TIME_Relative rem; as = db->lookup_account (db->cls, @@ -972,11 +972,13 @@ AH_handler_policy_post ( &puc->paid_until, &hc, &version); - now = GNUNET_TIME_absolute_get (); - if (puc->paid_until.abs_value_us < now.abs_value_us) + now = GNUNET_TIME_timestamp_get (); + if (GNUNET_TIME_timestamp_cmp (puc->paid_until, + (<), + now)) puc->paid_until = now; - rem = GNUNET_TIME_absolute_get_difference (puc->paid_until, - puc->end_date); + rem = GNUNET_TIME_absolute_get_difference (puc->paid_until.abs_time, + puc->end_date.abs_time); puc->years_to_pay = rem.rel_value_us / GNUNET_TIME_UNIT_YEARS.rel_value_us; if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) @@ -1122,7 +1124,7 @@ AH_handler_policy_post ( sizeof (expir_s), "%llu", (unsigned long long) - (puc->paid_until.abs_value_us + (puc->paid_until.abs_time.abs_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us)); switch (ss) { |