summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 19:19:32 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 19:19:32 +0100
commit36c2bb7d41b95564652a66b0de40527f78022582 (patch)
tree80c685dec5c3c8291a4f55076e31488d3ff76138
parentfbe1514b2241ec77af20f5d8a50183fcaa1155c6 (diff)
downloadanastasis-36c2bb7d41b95564652a66b0de40527f78022582.tar.gz
anastasis-36c2bb7d41b95564652a66b0de40527f78022582.tar.bz2
anastasis-36c2bb7d41b95564652a66b0de40527f78022582.zip
-fixing FTBFS for v11
-rw-r--r--src/authorization/anastasis_authorization_plugin_iban.c16
-rw-r--r--src/authorization/anastasis_authorization_plugin_totp.c12
-rw-r--r--src/authorization/libanastasiseufin/lae_common.h2
-rw-r--r--src/authorization/libanastasiseufin/lae_credit.c6
-rw-r--r--src/backend/anastasis-httpd_policy.c2
-rw-r--r--src/backend/anastasis-httpd_policy_upload.c32
-rw-r--r--src/backend/anastasis-httpd_truth.c22
-rw-r--r--src/include/anastasis_database_plugin.h18
-rw-r--r--src/include/anastasis_eufin_lib.h2
-rw-r--r--src/stasis/plugin_anastasis_postgres.c177
10 files changed, 143 insertions, 146 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_iban.c b/src/authorization/anastasis_authorization_plugin_iban.c
index 58a63a6..fec0d6d 100644
--- a/src/authorization/anastasis_authorization_plugin_iban.c
+++ b/src/authorization/anastasis_authorization_plugin_iban.c
@@ -461,12 +461,12 @@ test_wire_transfers (struct ANASTASIS_AUTHORIZATION_State *as)
struct ANASTASIS_DatabasePlugin *db = ctx->ac->db;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_TIME_Absolute limit;
+ struct GNUNET_TIME_Timestamp limit;
now = GNUNET_TIME_absolute_get ();
- limit = GNUNET_TIME_absolute_subtract (now,
- CODE_VALIDITY_PERIOD);
- (void) GNUNET_TIME_round_abs (&limit);
+ limit = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (now,
+ CODE_VALIDITY_PERIOD));
qs = db->test_auth_iban_payment (
db->cls,
as->iban_number,
@@ -520,7 +520,7 @@ iban_process (struct ANASTASIS_AUTHORIZATION_State *as,
enum GNUNET_DB_QueryStatus qs;
struct MHD_Response *resp;
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- struct GNUNET_TIME_Absolute after;
+ struct GNUNET_TIME_Timestamp after;
if (NULL == as->eh)
{
@@ -544,9 +544,9 @@ iban_process (struct ANASTASIS_AUTHORIZATION_State *as,
&bank_event_cb,
as);
}
- after = GNUNET_TIME_absolute_subtract (now,
- CODE_VALIDITY_PERIOD);
- (void) GNUNET_TIME_round_abs (&after);
+ after = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (now,
+ CODE_VALIDITY_PERIOD));
qs = db->test_challenge_code_satisfied (db->cls,
&as->truth_uuid,
as->code,
diff --git a/src/authorization/anastasis_authorization_plugin_totp.c b/src/authorization/anastasis_authorization_plugin_totp.c
index b3d5bc0..74d7b7c 100644
--- a/src/authorization/anastasis_authorization_plugin_totp.c
+++ b/src/authorization/anastasis_authorization_plugin_totp.c
@@ -144,7 +144,6 @@ compute_totp (int time_off,
uint8_t hmac[20]; /* SHA1: 20 bytes */
now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
while (time_off < 0)
{
now = GNUNET_TIME_absolute_subtract (now,
@@ -300,10 +299,9 @@ totp_process (struct ANASTASIS_AUTHORIZATION_State *as,
/* Build HTTP response */
{
struct MHD_Response *resp;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
if (TALER_MHD_xmime_matches (mime,
"application/json"))
{
@@ -313,8 +311,8 @@ totp_process (struct ANASTASIS_AUTHORIZATION_State *as,
GNUNET_JSON_pack_string ("hint",
TALER_ErrorCode_get_hint (
TALER_EC_ANASTASIS_TRUTH_CHALLENGE_FAILED)),
- GNUNET_JSON_pack_time_abs ("server_time",
- now));
+ GNUNET_JSON_pack_timestamp ("server_time",
+ now));
}
else
{
@@ -325,7 +323,7 @@ totp_process (struct ANASTASIS_AUTHORIZATION_State *as,
response_size
= GNUNET_asprintf (&response,
"Server time: %s",
- GNUNET_STRINGS_absolute_time_to_string (now));
+ GNUNET_TIME_timestamp2s (now));
resp = MHD_create_response_from_buffer (response_size,
response,
MHD_RESPMEM_MUST_COPY);
diff --git a/src/authorization/libanastasiseufin/lae_common.h b/src/authorization/libanastasiseufin/lae_common.h
index 8879ba3..1c2c8fd 100644
--- a/src/authorization/libanastasiseufin/lae_common.h
+++ b/src/authorization/libanastasiseufin/lae_common.h
@@ -36,7 +36,7 @@
* @param auth authentication data to use
* @return #GNUNET_OK in success
*/
-int
+enum GNUNET_GenericReturnValue
ANASTASIS_EUFIN_setup_auth_ (
CURL *easy,
const struct ANASTASIS_EUFIN_AuthenticationData *auth);
diff --git a/src/authorization/libanastasiseufin/lae_credit.c b/src/authorization/libanastasiseufin/lae_credit.c
index e8cabb5..d3fd781 100644
--- a/src/authorization/libanastasiseufin/lae_credit.c
+++ b/src/authorization/libanastasiseufin/lae_credit.c
@@ -65,7 +65,7 @@ struct ANASTASIS_EUFIN_CreditHistoryHandle
* were set,
* #GNUNET_SYSERR if there was a protocol violation in @a history
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_account_history (struct ANASTASIS_EUFIN_CreditHistoryHandle *hh,
const json_t *history)
{
@@ -89,8 +89,8 @@ parse_account_history (struct ANASTASIS_EUFIN_CreditHistoryHandle *hh,
struct GNUNET_JSON_Specification hist_spec[] = {
TALER_JSON_spec_amount_any ("amount",
&td.amount),
- TALER_JSON_spec_absolute_time ("date",
- &td.execution_date),
+ GNUNET_JSON_spec_timestamp ("date",
+ &td.execution_date),
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
GNUNET_JSON_spec_string ("subject",
diff --git a/src/backend/anastasis-httpd_policy.c b/src/backend/anastasis-httpd_policy.c
index 165be44..6e206a2 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -170,7 +170,7 @@ AH_policy_get (struct MHD_Connection *connection,
enum ANASTASIS_DB_AccountStatus as;
MHD_RESULT ret;
uint32_t version;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
as = db->lookup_account (db->cls,
account_pub,
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)
{
diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c
index 52d5dab..cbf13be 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -778,7 +778,7 @@ begin_payment (struct GetContext *gc)
{
/* Create a fresh order */
json_t *order;
- struct GNUNET_TIME_Absolute pay_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&gc->payment_identifier,
@@ -789,9 +789,8 @@ begin_payment (struct GetContext *gc)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Creating fresh order `%s'\n",
order_id);
- pay_deadline = GNUNET_TIME_relative_to_absolute (
+ pay_deadline = GNUNET_TIME_relative_to_timestamp (
ANASTASIS_CHALLENGE_OFFER_LIFETIME);
- GNUNET_TIME_round_abs (&pay_deadline);
order = GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("amount",
&gc->challenge_cost),
@@ -801,8 +800,8 @@ begin_payment (struct GetContext *gc)
order_id),
GNUNET_JSON_pack_time_rel ("auto_refund",
AUTO_REFUND_TIMEOUT),
- GNUNET_JSON_pack_time_abs ("pay_deadline",
- pay_deadline));
+ GNUNET_JSON_pack_timestamp ("pay_deadline",
+ pay_deadline));
gc->po = TALER_MERCHANT_orders_post2 (AH_ctx,
AH_backend_url,
order,
@@ -1006,14 +1005,14 @@ static enum GNUNET_GenericReturnValue
rate_limit (struct GetContext *gc)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute rt;
+ struct GNUNET_TIME_Timestamp rt;
uint64_t code;
enum ANASTASIS_DB_CodeStatus cs;
struct GNUNET_HashCode hc;
bool satisfied;
uint64_t dummy;
- rt = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rt = GNUNET_TIME_UNIT_FOREVER_TS;
qs = db->create_challenge_code (db->cls,
&gc->truth_uuid,
MAX_QUESTION_FREQ,
@@ -1618,7 +1617,7 @@ AH_handler_truth_get (
/* Setup challenge and begin authorization process */
{
- struct GNUNET_TIME_Absolute transmission_date;
+ struct GNUNET_TIME_Timestamp transmission_date;
enum GNUNET_DB_QueryStatus qs;
qs = db->create_challenge_code (db->cls,
@@ -1652,8 +1651,11 @@ AH_handler_truth_get (
break;
}
- if (GNUNET_TIME_absolute_get_duration (transmission_date).rel_value_us <
- gc->authorization->code_retransmission_frequency.rel_value_us)
+ 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/include/anastasis_database_plugin.h b/src/include/anastasis_database_plugin.h
index b698103..e5012a6 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -136,7 +136,7 @@ enum ANASTASIS_DB_StoreStatus
typedef void
(*ANASTASIS_DB_PaymentPendingIterator)(
void *cls,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct ANASTASIS_PaymentSecretP *payment_secret,
const struct TALER_Amount *amount);
@@ -468,7 +468,7 @@ struct ANASTASIS_DatabasePlugin
(*lookup_account)(
void *cls,
const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
- struct GNUNET_TIME_Absolute *paid_until,
+ struct GNUNET_TIME_Timestamp *paid_until,
struct GNUNET_HashCode *recovery_data_hash,
uint32_t *version);
@@ -525,7 +525,7 @@ struct ANASTASIS_DatabasePlugin
const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
const struct ANASTASIS_PaymentSecretP *payment_identifier,
struct GNUNET_TIME_Relative lifetime,
- struct GNUNET_TIME_Absolute *paid_until);
+ struct GNUNET_TIME_Timestamp *paid_until);
/**
@@ -543,7 +543,7 @@ struct ANASTASIS_DatabasePlugin
void *cls,
const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
const struct ANASTASIS_PaymentSecretP *payment_identifier,
- struct GNUNET_TIME_Absolute eol);
+ struct GNUNET_TIME_Timestamp eol);
/**
@@ -596,7 +596,7 @@ struct ANASTASIS_DatabasePlugin
(*check_truth_upload_paid)(
void *cls,
const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid,
- struct GNUNET_TIME_Absolute *paid_until);
+ struct GNUNET_TIME_Timestamp *paid_until);
/**
@@ -653,7 +653,7 @@ struct ANASTASIS_DatabasePlugin
void *cls,
const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
const uint64_t code,
- struct GNUNET_TIME_Absolute after);
+ struct GNUNET_TIME_Timestamp after);
/**
@@ -679,7 +679,7 @@ struct ANASTASIS_DatabasePlugin
struct GNUNET_TIME_Relative rotation_period,
struct GNUNET_TIME_Relative validity_period,
uint32_t retry_counter,
- struct GNUNET_TIME_Absolute *retransmission_date,
+ struct GNUNET_TIME_Timestamp *retransmission_date,
uint64_t *code);
@@ -780,7 +780,7 @@ struct ANASTASIS_DatabasePlugin
const struct TALER_Amount *amount,
const char *debit_account,
const char *credit_account,
- struct GNUNET_TIME_Absolute execution_date);
+ struct GNUNET_TIME_Timestamp execution_date);
/**
@@ -802,7 +802,7 @@ struct ANASTASIS_DatabasePlugin
(*test_auth_iban_payment)(
void *cls,
const char *debit_account,
- struct GNUNET_TIME_Absolute earliest_date,
+ struct GNUNET_TIME_Timestamp earliest_date,
ANASTASIS_DB_AuthIbanTransfercheck cb,
void *cb_cls);
diff --git a/src/include/anastasis_eufin_lib.h b/src/include/anastasis_eufin_lib.h
index daff98a..91b9fe3 100644
--- a/src/include/anastasis_eufin_lib.h
+++ b/src/include/anastasis_eufin_lib.h
@@ -112,7 +112,7 @@ struct ANASTASIS_EUFIN_CreditDetails
/**
* Time of the the transfer
*/
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
/**
* The wire transfer subject.
diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c
index bdbdc04..813da94 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -1072,7 +1072,7 @@ postgres_increment_lifetime (
const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
const struct ANASTASIS_PaymentSecretP *payment_identifier,
struct GNUNET_TIME_Relative lifetime,
- struct GNUNET_TIME_Absolute *paid_until)
+ struct GNUNET_TIME_Timestamp *paid_until)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -1101,7 +1101,7 @@ postgres_increment_lifetime (
{
case GNUNET_DB_STATUS_HARD_ERROR:
rollback (pg);
- *paid_until = GNUNET_TIME_UNIT_ZERO_ABS;
+ *paid_until = GNUNET_TIME_UNIT_ZERO_TS;
return qs;
case GNUNET_DB_STATUS_SOFT_ERROR:
goto retry;
@@ -1120,10 +1120,10 @@ postgres_increment_lifetime (
GNUNET_PQ_query_param_auto_from_type (account_pub),
GNUNET_PQ_query_param_end
};
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration_date",
- &expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &expiration),
GNUNET_PQ_result_spec_end
};
@@ -1151,13 +1151,12 @@ postgres_increment_lifetime (
/* user does not exist, create new one */
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (account_pub),
- GNUNET_PQ_query_param_absolute_time (&expiration),
+ GNUNET_PQ_query_param_timestamp (&expiration),
GNUNET_PQ_query_param_end
};
- expiration = GNUNET_TIME_relative_to_absolute (lifetime);
- GNUNET_break (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- expiration.abs_value_us);
+ expiration = GNUNET_TIME_relative_to_timestamp (lifetime);
+ GNUNET_break (! GNUNET_TIME_absolute_is_never (expiration.abs_time));
*paid_until = expiration;
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"user_insert",
@@ -1173,22 +1172,24 @@ postgres_increment_lifetime (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Payment existed, lifetime of account %s unchanged at %s\n",
TALER_B2S (account_pub),
- GNUNET_STRINGS_absolute_time_to_string (*paid_until));
+ GNUNET_TIME_timestamp2s (*paid_until));
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
}
else
{
/* user exists, update expiration_date */
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_absolute_time (&expiration),
+ GNUNET_PQ_query_param_timestamp (&expiration),
GNUNET_PQ_query_param_auto_from_type (account_pub),
GNUNET_PQ_query_param_end
};
- expiration = GNUNET_TIME_absolute_add (expiration,
- lifetime);
- GNUNET_break (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- expiration.abs_value_us);
+ expiration
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (expiration.abs_time,
+ lifetime));
+ GNUNET_break (! GNUNET_TIME_absolute_is_never (
+ expiration.abs_time));
*paid_until = expiration;
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"user_update",
@@ -1220,7 +1221,7 @@ postgres_increment_lifetime (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Incremented lifetime of account %s to %s\n",
TALER_B2S (account_pub),
- GNUNET_STRINGS_absolute_time_to_string (*paid_until));
+ GNUNET_TIME_timestamp2s (*paid_until));
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
retry:
rollback (pg);
@@ -1244,7 +1245,7 @@ postgres_update_lifetime (
void *cls,
const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
const struct ANASTASIS_PaymentSecretP *payment_identifier,
- struct GNUNET_TIME_Absolute eol)
+ struct GNUNET_TIME_Timestamp eol)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -1288,10 +1289,10 @@ postgres_update_lifetime (
GNUNET_PQ_query_param_auto_from_type (account_pub),
GNUNET_PQ_query_param_end
};
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration_date",
- &expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &expiration),
GNUNET_PQ_result_spec_end
};
@@ -1311,41 +1312,39 @@ postgres_update_lifetime (
/* user does not exist, create new one */
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (account_pub),
- GNUNET_PQ_query_param_absolute_time (&eol),
+ GNUNET_PQ_query_param_timestamp (&eol),
GNUNET_PQ_query_param_end
};
- GNUNET_break (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- eol.abs_value_us);
+ GNUNET_break (! GNUNET_TIME_absolute_is_never (eol.abs_time));
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"user_insert",
params);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Created new account %s with expiration %s\n",
TALER_B2S (account_pub),
- GNUNET_STRINGS_absolute_time_to_string (eol));
+ GNUNET_TIME_timestamp2s (eol));
}
break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
{
/* user exists, update expiration_date */
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_absolute_time (&expiration),
+ GNUNET_PQ_query_param_timestamp (&expiration),
GNUNET_PQ_query_param_auto_from_type (account_pub),
GNUNET_PQ_query_param_end
};
- expiration = GNUNET_TIME_absolute_max (expiration,
- eol);
- GNUNET_break (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- expiration.abs_value_us);
+ expiration = GNUNET_TIME_timestamp_max (expiration,
+ eol);
+ GNUNET_break (! GNUNET_TIME_absolute_is_never (expiration.abs_time));
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"user_update",
params);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Updated account %s to new expiration %s\n",
TALER_B2S (account_pub),
- GNUNET_STRINGS_absolute_time_to_string (expiration));
+ GNUNET_TIME_timestamp2s (expiration));
}
break;
}
@@ -1399,14 +1398,14 @@ postgres_record_recdoc_payment (
const struct TALER_Amount *amount)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (account_pub),
GNUNET_PQ_query_param_uint32 (&post_counter),
TALER_PQ_query_param_amount (amount),
GNUNET_PQ_query_param_auto_from_type (payment_secret),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -1423,8 +1422,8 @@ postgres_record_recdoc_payment (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration_date",
- &expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &expiration),
GNUNET_PQ_result_spec_end
};
@@ -1443,11 +1442,11 @@ postgres_record_recdoc_payment (
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
{
/* create new user with short lifetime */
- struct GNUNET_TIME_Absolute exp
- = GNUNET_TIME_relative_to_absolute (TRANSIENT_LIFETIME);
+ struct GNUNET_TIME_Timestamp exp
+ = GNUNET_TIME_relative_to_timestamp (TRANSIENT_LIFETIME);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (account_pub),
- GNUNET_PQ_query_param_absolute_time (&exp),
+ GNUNET_PQ_query_param_timestamp (&exp),
GNUNET_PQ_query_param_end
};
@@ -1469,7 +1468,7 @@ postgres_record_recdoc_payment (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Created new account %s with transient life until %s\n",
TALER_B2S (account_pub),
- GNUNET_STRINGS_absolute_time_to_string (exp));
+ GNUNET_TIME_timestamp2s (exp));
break;
}
}
@@ -1503,11 +1502,12 @@ postgres_record_truth_upload_payment (
struct GNUNET_TIME_Relative duration)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute exp = GNUNET_TIME_relative_to_absolute (duration);
+ struct GNUNET_TIME_Timestamp exp = GNUNET_TIME_relative_to_timestamp (
+ duration);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (uuid),
TALER_PQ_query_param_amount (amount),
- GNUNET_PQ_query_param_absolute_time (&exp),
+ GNUNET_PQ_query_param_timestamp (&exp),
GNUNET_PQ_query_param_end
};
@@ -1530,18 +1530,18 @@ static enum GNUNET_DB_QueryStatus
postgres_check_truth_upload_paid (
void *cls,
const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid,
- struct GNUNET_TIME_Absolute *paid_until)
+ struct GNUNET_TIME_Timestamp *paid_until)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (uuid),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- paid_until),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ paid_until),
GNUNET_PQ_result_spec_end
};
@@ -1570,12 +1570,12 @@ postgres_record_challenge_payment (
const struct TALER_Amount *amount)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
TALER_PQ_query_param_amount (amount),
GNUNET_PQ_query_param_auto_from_type (payment_secret),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_end
};
@@ -1634,7 +1634,7 @@ postgres_record_auth_iban_payment (
const struct TALER_Amount *amount,
const char *debit_account,
const char *credit_account,
- struct GNUNET_TIME_Absolute execution_date)
+ struct GNUNET_TIME_Timestamp execution_date)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -1643,7 +1643,7 @@ postgres_record_auth_iban_payment (
TALER_PQ_query_param_amount (amount),
GNUNET_PQ_query_param_string (debit_account),
GNUNET_PQ_query_param_string (credit_account),
- GNUNET_PQ_query_param_absolute_time (&execution_date),
+ GNUNET_PQ_query_param_timestamp (&execution_date),
GNUNET_PQ_query_param_end
};
@@ -1753,7 +1753,7 @@ static enum GNUNET_DB_QueryStatus
postgres_test_auth_iban_payment (
void *cls,
const char *debit_account,
- struct GNUNET_TIME_Absolute earliest_date,
+ struct GNUNET_TIME_Timestamp earliest_date,
ANASTASIS_DB_AuthIbanTransfercheck cb,
void *cb_cls)
{
@@ -1765,7 +1765,7 @@ postgres_test_auth_iban_payment (
};
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (debit_account),
- TALER_PQ_query_param_absolute_time (&earliest_date),
+ GNUNET_PQ_query_param_timestamp (&earliest_date),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -1936,7 +1936,7 @@ postgres_store_truth (
struct GNUNET_TIME_Relative truth_expiration)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
GNUNET_PQ_query_param_auto_from_type (key_share_data),
@@ -1944,14 +1944,12 @@ postgres_store_truth (
GNUNET_PQ_query_param_fixed_size (encrypted_truth,
encrypted_truth_size),
GNUNET_PQ_query_param_string (mime_type),
- TALER_PQ_query_param_absolute_time (&expiration),
+ GNUNET_PQ_query_param_timestamp (&expiration),
GNUNET_PQ_query_param_end
};
- expiration = GNUNET_TIME_absolute_add (expiration,
- truth_expiration);
- GNUNET_TIME_round_abs (&expiration);
+ expiration = GNUNET_TIME_relative_to_timestamp (truth_expiration);
check_connection (pg);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"truth_insert",
@@ -2051,7 +2049,7 @@ enum ANASTASIS_DB_AccountStatus
postgres_lookup_account (
void *cls,
const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub,
- struct GNUNET_TIME_Absolute *paid_until,
+ struct GNUNET_TIME_Timestamp *paid_until,
struct GNUNET_HashCode *recovery_data_hash,
uint32_t *version)
{
@@ -2067,8 +2065,8 @@ postgres_lookup_account (
postgres_preflight (pg));
{
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration_date",
- paid_until),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ paid_until),
GNUNET_PQ_result_spec_auto_from_type ("recovery_data_hash",
recovery_data_hash),
GNUNET_PQ_result_spec_uint32 ("version",
@@ -2097,8 +2095,8 @@ postgres_lookup_account (
/* check if account exists */
{
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration_date",
- paid_until),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ paid_until),
GNUNET_PQ_result_spec_end
};
@@ -2372,17 +2370,16 @@ postgres_verify_challenge_code (
.hashed_code = hashed_code,
.pg = pg
};
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
- TALER_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
*satisfied = false;
check_connection (pg);
- GNUNET_TIME_round_abs (&now);
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
"challengecode_select",
params,
@@ -2447,13 +2444,13 @@ postgres_test_challenge_code_satisfied (
void *cls,
const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
const uint64_t code,
- struct GNUNET_TIME_Absolute after)
+ struct GNUNET_TIME_Timestamp after)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
GNUNET_PQ_query_param_uint64 (&code),
- GNUNET_PQ_query_param_absolute_time (&after),
+ GNUNET_PQ_query_param_timestamp (&after),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -2483,12 +2480,13 @@ postgres_lookup_challenge_payment (
{
struct PostgresClosure *pg = cls;
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- struct GNUNET_TIME_Absolute recent
- = GNUNET_TIME_absolute_subtract (now,
- ANASTASIS_CHALLENGE_OFFER_LIFETIME);
+ struct GNUNET_TIME_Timestamp recent
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (now,
+ ANASTASIS_CHALLENGE_OFFER_LIFETIME));
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
- GNUNET_PQ_query_param_absolute_time (&recent),
+ GNUNET_PQ_query_param_timestamp (&recent),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -2555,20 +2553,18 @@ postgres_create_challenge_code (
struct GNUNET_TIME_Relative rotation_period,
struct GNUNET_TIME_Relative validity_period,
uint32_t retry_counter,
- struct GNUNET_TIME_Absolute *retransmission_date,
+ struct GNUNET_TIME_Timestamp *retransmission_date,
uint64_t *code)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- struct GNUNET_TIME_Absolute expiration_date;
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
+ struct GNUNET_TIME_Timestamp expiration_date;
struct GNUNET_TIME_Absolute ex_rot;
check_connection (pg);
- GNUNET_TIME_round_abs (&now);
- expiration_date = GNUNET_TIME_absolute_add (now,
- validity_period);
- ex_rot = GNUNET_TIME_absolute_subtract (now,
+ expiration_date = GNUNET_TIME_relative_to_timestamp (validity_period);
+ ex_rot = GNUNET_TIME_absolute_subtract (now.abs_time,
rotation_period);
for (unsigned int retries = 0; retries<MAX_RETRIES; retries++)
{
@@ -2584,8 +2580,8 @@ postgres_create_challenge_code (
uint32_t old_retry_counter;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
- TALER_PQ_query_param_absolute_time (&now),
- TALER_PQ_query_param_absolute_time (&ex_rot),
+ GNUNET_PQ_query_param_timestamp (&now),
+ GNUNET_PQ_query_param_absolute_time (&ex_rot),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -2593,8 +2589,8 @@ postgres_create_challenge_code (
code),
GNUNET_PQ_result_spec_uint32 ("retry_counter",
&old_retry_counter),
- GNUNET_PQ_result_spec_absolute_time ("retransmission_date",
- retransmission_date),
+ GNUNET_PQ_result_spec_timestamp ("retransmission_date",
+ retransmission_date),
GNUNET_PQ_result_spec_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -2634,13 +2630,13 @@ postgres_create_challenge_code (
*code = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
NONCE_MAX_VALUE);
- *retransmission_date = GNUNET_TIME_UNIT_ZERO_ABS;
+ *retransmission_date = GNUNET_TIME_UNIT_ZERO_TS;
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
GNUNET_PQ_query_param_uint64 (code),
- TALER_PQ_query_param_absolute_time (&now),
- TALER_PQ_query_param_absolute_time (&expiration_date),
+ GNUNET_PQ_query_param_timestamp (&now),
+ GNUNET_PQ_query_param_timestamp (&expiration_date),
GNUNET_PQ_query_param_uint32 (&retry_counter),
GNUNET_PQ_query_param_end
};
@@ -2699,16 +2695,15 @@ postgres_mark_challenge_sent (
check_connection (pg);
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (truth_uuid),
GNUNET_PQ_query_param_uint64 (&code),
- TALER_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_end
};
- now = GNUNET_TIME_absolute_get ();
- GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"challengecode_mark_sent",
params);
@@ -2741,9 +2736,9 @@ enum GNUNET_DB_QueryStatus
postgres_challenge_gc (void *cls)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute time_now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp time_now = GNUNET_TIME_timestamp_get ();
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_absolute_time (&time_now),
+ GNUNET_PQ_query_param_timestamp (&time_now),
GNUNET_PQ_query_param_end
};