summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/anastasis-httpd_policy_upload.c2
-rw-r--r--src/backend/anastasis-httpd_truth.c10
-rw-r--r--src/backend/anastasis-httpd_truth_upload.c31
-rw-r--r--src/include/anastasis.h2
-rw-r--r--src/include/anastasis_service.h2
-rw-r--r--src/lib/anastasis_backup.c2
-rw-r--r--src/reducer/anastasis_api_backup_redux.c47
-rw-r--r--src/restclient/anastasis_api_policy_store.c3
8 files changed, 50 insertions, 49 deletions
diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c
index b9ab266..4c86241 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -974,7 +974,7 @@ AH_handler_policy_post (
&version);
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.abs_time,
diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c
index cbf13be..6c05ef8 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -1651,11 +1651,11 @@ AH_handler_truth_get (
break;
}
- if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
- transmission_date.abs_time),
- (<),
- gc->authorization->
- code_retransmission_frequency) )
+ if (GNUNET_TIME_relative_cmp (
+ GNUNET_TIME_absolute_get_duration (
+ transmission_date.abs_time),
+ <,
+ gc->authorization->code_retransmission_frequency) )
{
/* Too early for a retransmission! */
GNUNET_free (decrypted_truth);
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:
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index c7ab630..fd7ed40 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -845,7 +845,7 @@ struct ANASTASIS_ProviderSuccessStatus
/**
* When will the policy expire?
*/
- struct GNUNET_TIME_Absolute policy_expiration;
+ struct GNUNET_TIME_Timestamp policy_expiration;
/**
* Version number of the policy at the provider.
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index d6d7d4c..b6b3d76 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -337,7 +337,7 @@ struct ANASTASIS_UploadDetails
* At what time is the provider set to forget this
* policy (because the account expires)?
*/
- struct GNUNET_TIME_Absolute policy_expiration;
+ struct GNUNET_TIME_Timestamp policy_expiration;
/**
* Version number of the resulting policy.
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c
index c9273d0..711fcd4 100644
--- a/src/lib/anastasis_backup.c
+++ b/src/lib/anastasis_backup.c
@@ -571,7 +571,7 @@ struct PolicyStoreState
/**
* When will the policy expire at the provider.
*/
- struct GNUNET_TIME_Absolute policy_expiration;
+ struct GNUNET_TIME_Timestamp policy_expiration;
};
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c
index fab5230..e300081 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -2455,12 +2455,12 @@ del_challenge (json_t *state,
* @return number of years of service to pay for
*/
static unsigned int
-expiration_to_years (struct GNUNET_TIME_Absolute expiration)
+expiration_to_years (struct GNUNET_TIME_Timestamp expiration)
{
struct GNUNET_TIME_Relative rem;
unsigned int years;
- rem = GNUNET_TIME_absolute_get_remaining (expiration);
+ rem = GNUNET_TIME_absolute_get_remaining (expiration.abs_time);
years = rem.rel_value_us / GNUNET_TIME_UNIT_YEARS.rel_value_us;
if (0 != rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)
years++;
@@ -2480,7 +2480,7 @@ expiration_to_years (struct GNUNET_TIME_Absolute expiration)
*/
static enum GNUNET_GenericReturnValue
update_expiration_cost (json_t *state,
- struct GNUNET_TIME_Absolute expiration)
+ struct GNUNET_TIME_Timestamp expiration)
{
struct Costs *costs = NULL;
unsigned int years;
@@ -2695,13 +2695,12 @@ update_expiration_cost (json_t *state,
}
if (is_free)
- expiration = GNUNET_TIME_relative_to_absolute (ANASTASIS_FREE_STORAGE);
+ expiration = GNUNET_TIME_relative_to_timestamp (ANASTASIS_FREE_STORAGE);
/* update 'expiration' in state */
{
json_t *eo;
- (void) GNUNET_TIME_round_abs (&expiration);
- eo = GNUNET_JSON_from_time_abs (expiration);
+ eo = GNUNET_JSON_from_timestamp (expiration);
GNUNET_assert (0 ==
json_object_set_new (state,
"expiration",
@@ -2742,11 +2741,12 @@ done_policy_review (json_t *state,
return NULL;
}
{
- struct GNUNET_TIME_Absolute exp = {0};
+ struct GNUNET_TIME_Timestamp exp
+ = GNUNET_TIME_UNIT_ZERO_TS;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_absolute_time ("expiration",
- &exp)),
+ GNUNET_JSON_spec_timestamp ("expiration",
+ &exp)),
GNUNET_JSON_spec_end ()
};
@@ -2761,8 +2761,8 @@ done_policy_review (json_t *state,
"invalid expiration specified");
return NULL;
}
- if (0 == exp.abs_value_us)
- exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
+ if (GNUNET_TIME_absolute_is_zero (exp.abs_time))
+ exp = GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_YEARS);
if (GNUNET_OK !=
update_expiration_cost (state,
exp))
@@ -3054,8 +3054,8 @@ secret_share_result_cb (void *cls,
d = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("policy_version",
pssi->policy_version),
- GNUNET_JSON_pack_time_abs ("policy_expiration",
- pssi->policy_expiration));
+ GNUNET_JSON_pack_timestamp ("policy_expiration",
+ pssi->policy_expiration));
GNUNET_assert (NULL != d);
GNUNET_assert (0 ==
json_object_set_new (sa,
@@ -3992,10 +3992,10 @@ upload (json_t *state,
struct UploadContext *uc;
json_t *auth_methods;
json_t *policies;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_absolute_time ("expiration",
- &expiration),
+ GNUNET_JSON_spec_timestamp ("expiration",
+ &expiration),
GNUNET_JSON_spec_end ()
};
@@ -4320,13 +4320,14 @@ enter_secret (json_t *state,
void *cb_cls)
{
json_t *jsecret;
- struct GNUNET_TIME_Absolute expiration = {0};
+ struct GNUNET_TIME_Timestamp expiration
+ = GNUNET_TIME_UNIT_ZERO_TS;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_json ("secret",
&jsecret),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_absolute_time ("expiration",
- &expiration)),
+ GNUNET_JSON_spec_timestamp ("expiration",
+ &expiration)),
GNUNET_JSON_spec_end ()
};
@@ -4374,7 +4375,7 @@ enter_secret (json_t *state,
break;
}
}
- if (0 != expiration.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (expiration.abs_time))
{
if (GNUNET_OK !=
update_expiration_cost (state,
@@ -4505,10 +4506,10 @@ update_expiration (json_t *state,
ANASTASIS_ActionCallback cb,
void *cb_cls)
{
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_absolute_time ("expiration",
- &expiration),
+ GNUNET_JSON_spec_timestamp ("expiration",
+ &expiration),
GNUNET_JSON_spec_end ()
};
diff --git a/src/restclient/anastasis_api_policy_store.c b/src/restclient/anastasis_api_policy_store.c
index 22d6330..8e3c546 100644
--- a/src/restclient/anastasis_api_policy_store.c
+++ b/src/restclient/anastasis_api_policy_store.c
@@ -165,8 +165,7 @@ handle_policy_store_finished (void *cls,
ud.us = ANASTASIS_US_SUCCESS;
ud.details.success.curr_backup_hash = &pso->new_upload_hash;
ud.details.success.policy_expiration
- = GNUNET_TIME_absolute_add (
- GNUNET_TIME_UNIT_ZERO_ABS,
+ = GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_SECONDS,
expiration));