summaryrefslogtreecommitdiff
path: root/src/backend/anastasis-httpd_truth_upload.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/anastasis-httpd_truth_upload.c')
-rw-r--r--src/backend/anastasis-httpd_truth_upload.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/backend/anastasis-httpd_truth_upload.c b/src/backend/anastasis-httpd_truth_upload.c
index e4bce9c..ddf645c 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -526,7 +526,7 @@ AH_handler_truth_post (
const char *type;
enum GNUNET_DB_QueryStatus qs;
uint32_t storage_years;
- struct GNUNET_TIME_Absolute paid_until;
+ struct GNUNET_TIME_Timestamp paid_until;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("key_share_data",
&key_share_data),
@@ -703,11 +703,11 @@ AH_handler_truth_post (
if (0 != TALER_amount_cmp (&AH_truth_upload_fee,
&zero_amount))
{
- struct GNUNET_TIME_Absolute desired_until;
+ struct GNUNET_TIME_Timestamp desired_until;
enum GNUNET_DB_QueryStatus qs;
desired_until
- = GNUNET_TIME_relative_to_absolute (
+ = GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
storage_years));
qs = db->check_truth_upload_paid (db->cls,
@@ -719,16 +719,16 @@ AH_handler_truth_post (
TALER_EC_GENERIC_DB_FETCH_FAILED,
NULL);
if ( (0 == qs) ||
- (paid_until.abs_value_us < desired_until.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (paid_until,
+ <,
+ desired_until) ) )
{
- struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Relative rem;
- now = GNUNET_TIME_absolute_get ();
- if (paid_until.abs_value_us < now.abs_value_us)
- paid_until = now;
- rem = GNUNET_TIME_absolute_get_difference (paid_until,
- desired_until);
+ if (GNUNET_TIME_absolute_is_past (paid_until.abs_time))
+ paid_until = GNUNET_TIME_timestamp_get ();
+ rem = GNUNET_TIME_absolute_get_difference (paid_until.abs_time,
+ desired_until.abs_time);
tuc->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))
@@ -755,16 +755,16 @@ AH_handler_truth_post (
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"TRUTH paid until %s (%d)!\n",
- GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_relative2s (
GNUNET_TIME_absolute_get_remaining (
- paid_until),
+ paid_until.abs_time),
GNUNET_YES),
qs);
}
else
{
paid_until
- = GNUNET_TIME_relative_to_absolute (
+ = GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
ANASTASIS_MAX_YEARS_STORAGE));
}
@@ -773,7 +773,7 @@ AH_handler_truth_post (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Storing truth until %s!\n",
- GNUNET_STRINGS_absolute_time_to_string (paid_until));
+ GNUNET_TIME_timestamp2s (paid_until));
qs = db->store_truth (db->cls,
truth_uuid,
&key_share_data,
@@ -783,7 +783,8 @@ AH_handler_truth_post (
encrypted_truth,
encrypted_truth_size,
type,
- GNUNET_TIME_absolute_get_remaining (paid_until));
+ GNUNET_TIME_absolute_get_remaining (
+ paid_until.abs_time));
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR: