aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:32 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:40 +0100
commit1a1fafbd438f3f21a15c990d904e192b045d2391 (patch)
treecdd32023fd1d7c530caeae0487528d7eaac2aa29 /src
parentbf54ee30d4727217264f470321cc2f91facf63cc (diff)
introducing GNUNET_TIME_Timestamp, recoup now with amounts
Diffstat (limited to 'src')
-rw-r--r--src/auditor/Makefile.am13
-rw-r--r--src/auditor/report-lib.c8
-rw-r--r--src/auditor/taler-auditor-httpd_deposit-confirmation.c36
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c48
-rw-r--r--src/auditor/taler-helper-auditor-coins.c109
-rw-r--r--src/auditor/taler-helper-auditor-deposits.c23
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c97
-rw-r--r--src/auditor/taler-helper-auditor-wire.c403
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c88
-rw-r--r--src/bank-lib/bank_api_admin.c31
-rw-r--r--src/bank-lib/bank_api_common.c9
-rw-r--r--src/bank-lib/bank_api_credit.c4
-rw-r--r--src/bank-lib/bank_api_debit.c6
-rw-r--r--src/bank-lib/bank_api_parse.c16
-rw-r--r--src/bank-lib/bank_api_transfer.c6
-rw-r--r--src/bank-lib/fakebank.c35
-rw-r--r--src/bank-lib/taler-exchange-wire-gateway-client.c10
-rw-r--r--src/benchmark/taler-aggregator-benchmark.c48
-rw-r--r--src/exchange-tools/Makefile.am2
-rw-r--r--src/exchange-tools/taler-auditor-offline.c63
-rw-r--r--src/exchange-tools/taler-exchange-offline.c213
-rw-r--r--src/exchange/taler-exchange-aggregator.c21
-rw-r--r--src/exchange/taler-exchange-closer.c22
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c56
-rw-r--r--src/exchange/taler-exchange-httpd_deposits_get.c14
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c227
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.c11
-rw-r--r--src/exchange/taler-exchange-httpd_management_auditors.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_disable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_enable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_fees.c14
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c21
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c31
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c16
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c61
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h2
-rw-r--r--src/exchange/taler-exchange-httpd_transfers_get.c17
-rw-r--r--src/exchange/taler-exchange-httpd_wire.c12
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c33
-rw-r--r--src/exchange/taler-exchange-transfer.c9
-rw-r--r--src/exchangedb/irbt_callbacks.c44
-rw-r--r--src/exchangedb/lrbt_callbacks.c70
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c592
-rw-r--r--src/include/taler_auditor_service.h12
-rw-r--r--src/include/taler_auditordb_plugin.h32
-rw-r--r--src/include/taler_bank_service.h45
-rw-r--r--src/include/taler_crypto_lib.h94
-rw-r--r--src/include/taler_exchange_service.h80
-rw-r--r--src/include/taler_exchangedb_plugin.h156
-rw-r--r--src/include/taler_json_lib.h96
-rw-r--r--src/include/taler_pq_lib.h57
-rw-r--r--src/include/taler_signatures.h66
-rw-r--r--src/include/taler_sq_lib.h53
-rw-r--r--src/include/taler_testing_lib.h57
-rw-r--r--src/json/json_helper.c213
-rw-r--r--src/json/json_pack.c40
-rw-r--r--src/lib/auditor_api_curl_defaults.c12
-rw-r--r--src/lib/auditor_api_deposit_confirmation.c55
-rw-r--r--src/lib/exchange_api_auditor_add_denomination.c6
-rw-r--r--src/lib/exchange_api_common.c46
-rw-r--r--src/lib/exchange_api_curl_defaults.c3
-rw-r--r--src/lib/exchange_api_deposit.c38
-rw-r--r--src/lib/exchange_api_deposits_get.c10
-rw-r--r--src/lib/exchange_api_handle.c171
-rw-r--r--src/lib/exchange_api_handle.h2
-rw-r--r--src/lib/exchange_api_kyc_check.c6
-rw-r--r--src/lib/exchange_api_management_auditor_disable.c12
-rw-r--r--src/lib/exchange_api_management_auditor_enable.c12
-rw-r--r--src/lib/exchange_api_management_get_keys.c59
-rw-r--r--src/lib/exchange_api_management_post_keys.c6
-rw-r--r--src/lib/exchange_api_management_revoke_denomination_key.c6
-rw-r--r--src/lib/exchange_api_management_revoke_signing_key.c6
-rw-r--r--src/lib/exchange_api_management_set_wire_fee.c18
-rw-r--r--src/lib/exchange_api_management_wire_disable.c12
-rw-r--r--src/lib/exchange_api_management_wire_enable.c12
-rw-r--r--src/lib/exchange_api_recoup.c3
-rw-r--r--src/lib/exchange_api_refresh_common.c8
-rw-r--r--src/lib/exchange_api_refresh_common.h2
-rw-r--r--src/lib/exchange_api_refund.c12
-rw-r--r--src/lib/exchange_api_transfers_get.c4
-rw-r--r--src/lib/exchange_api_wire.c8
-rw-r--r--src/pq/pq_query_helper.c119
-rw-r--r--src/pq/pq_result_helper.c140
-rw-r--r--src/sq/sq_query_helper.c160
-rw-r--r--src/sq/sq_result_helper.c154
-rw-r--r--src/testing/test_taler_exchange_aggregator.c48
-rw-r--r--src/testing/testing_api_cmd_auditor_add.c5
-rw-r--r--src/testing/testing_api_cmd_auditor_del.c5
-rw-r--r--src/testing/testing_api_cmd_auditor_deposit_confirmation.c26
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c8
-rw-r--r--src/testing/testing_api_cmd_bank_transfer.c6
-rw-r--r--src/testing/testing_api_cmd_check_keys.c23
-rw-r--r--src/testing/testing_api_cmd_deposit.c48
-rw-r--r--src/testing/testing_api_cmd_insert_deposit.c35
-rw-r--r--src/testing/testing_api_cmd_recoup.c8
-rw-r--r--src/testing/testing_api_cmd_set_wire_fee.c15
-rw-r--r--src/testing/testing_api_cmd_status.c5
-rw-r--r--src/testing/testing_api_cmd_wire_add.c5
-rw-r--r--src/testing/testing_api_cmd_wire_del.c5
-rw-r--r--src/testing/testing_api_helpers_exchange.c29
-rw-r--r--src/util/auditor_signatures.c32
-rw-r--r--src/util/crypto_helper_esign.c6
-rw-r--r--src/util/crypto_helper_rsa.c6
-rw-r--r--src/util/exchange_signatures.c12
-rw-r--r--src/util/offline_signatures.c108
-rw-r--r--src/util/secmod_signatures.c16
-rw-r--r--src/util/taler-exchange-secmod-eddsa.c96
-rw-r--r--src/util/taler-exchange-secmod-eddsa.h2
-rw-r--r--src/util/taler-exchange-secmod-rsa.c109
-rw-r--r--src/util/taler-exchange-secmod-rsa.h2
-rw-r--r--src/util/test_helper_eddsa.c8
-rw-r--r--src/util/test_helper_rsa.c42
-rw-r--r--src/util/wallet_signatures.c20
114 files changed, 2189 insertions, 3233 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index b876805b2..49f4030ea 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -54,13 +54,12 @@ libauditorreport_la_LIBADD = \
taler_auditor_dbinit_SOURCES = \
taler-auditor-dbinit.c
taler_auditor_dbinit_LDADD = \
- $(LIBGCRYPT_LIBS) \
- $(top_builddir)/src/util/libtalerutil.la \
- $(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/auditordb/libtalerauditordb.la \
- -lgnunetutil $(XLIB)
-taler_auditor_dbinit_LDFLAGS = \
- $(POSTGRESQL_LDFLAGS)
+ $(top_builddir)/src/pq/libtalerpq.la \
+ $(top_builddir)/src/util/libtalerutil.la \
+ -lgnunetutil \
+ $(LIBGCRYPT_LIBS) \
+ $(XLIB)
taler_auditor_dbinit_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \
@@ -182,8 +181,6 @@ taler_auditor_sync_LDADD = \
-lgnunetutil \
$(LIBGCRYPT_LIBS) \
$(XLIB)
-taler_auditor_sync_LDFLAGS = \
- $(POSTGRESQL_LDFLAGS)
taler_auditor_sync_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c
index e6468f692..0dea786da 100644
--- a/src/auditor/report-lib.c
+++ b/src/auditor/report-lib.c
@@ -160,12 +160,12 @@ add_denomination (
TALER_amount2s (&value));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Start time is %s\n",
- GNUNET_STRINGS_absolute_time_to_string
- (GNUNET_TIME_absolute_ntoh (issue->start)));
+ GNUNET_TIME_timestamp2s
+ (GNUNET_TIME_timestamp_ntoh (issue->start)));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Expire deposit time is %s\n",
- GNUNET_STRINGS_absolute_time_to_string
- (GNUNET_TIME_absolute_ntoh (issue->expire_deposit)));
+ GNUNET_TIME_timestamp2s
+ (GNUNET_TIME_timestamp_ntoh (issue->expire_deposit)));
}
#endif
{
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
index 8f16f36fe..d2ab03705 100644
--- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c
+++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
@@ -63,21 +63,19 @@ verify_and_execute_deposit_confirmation (
const struct TALER_AUDITORDB_ExchangeSigningKey *es)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
struct GNUNET_HashCode h;
const char *cached;
struct TALER_ExchangeSigningKeyValidityPS skv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
.purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)),
- .start = GNUNET_TIME_absolute_hton (es->ep_start),
- .expire = GNUNET_TIME_absolute_hton (es->ep_expire),
- .end = GNUNET_TIME_absolute_hton (es->ep_end),
+ .start = GNUNET_TIME_timestamp_hton (es->ep_start),
+ .expire = GNUNET_TIME_timestamp_hton (es->ep_expire),
+ .end = GNUNET_TIME_timestamp_hton (es->ep_end),
.signkey_pub = es->exchange_pub
};
- now = GNUNET_TIME_absolute_get ();
- if ( (es->ep_start.abs_value_us > now.abs_value_us) ||
- (es->ep_expire.abs_value_us < now.abs_value_us) )
+ if (GNUNET_TIME_absolute_is_future (es->ep_start.abs_time) ||
+ GNUNET_TIME_absolute_is_past (es->ep_expire.abs_time) )
{
/* Signing key expired */
TALER_LOG_WARNING ("Expired exchange signing key\n");
@@ -253,12 +251,12 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
&dc.h_extensions),
GNUNET_JSON_spec_fixed_auto ("h_wire",
&dc.h_wire),
- TALER_JSON_spec_absolute_time ("exchange_timestamp",
- &dc.exchange_timestamp),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &dc.refund_deadline),
- TALER_JSON_spec_absolute_time ("wire_deadline",
- &dc.wire_deadline),
+ GNUNET_JSON_spec_timestamp ("exchange_timestamp",
+ &dc.exchange_timestamp),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &dc.refund_deadline),
+ GNUNET_JSON_spec_timestamp ("wire_deadline",
+ &dc.wire_deadline),
TALER_JSON_spec_amount ("amount_without_fee",
TAH_currency,
&dc.amount_without_fee),
@@ -272,12 +270,12 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
&dc.exchange_pub),
GNUNET_JSON_spec_fixed_auto ("master_pub",
&es.master_public_key),
- TALER_JSON_spec_absolute_time ("ep_start",
- &es.ep_start),
- TALER_JSON_spec_absolute_time ("ep_expire",
- &es.ep_expire),
- TALER_JSON_spec_absolute_time ("ep_end",
- &es.ep_end),
+ GNUNET_JSON_spec_timestamp ("ep_start",
+ &es.ep_start),
+ GNUNET_JSON_spec_timestamp ("ep_expire",
+ &es.ep_expire),
+ GNUNET_JSON_spec_timestamp ("ep_end",
+ &es.ep_end),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&es.master_sig),
GNUNET_JSON_spec_end ()
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index edb9f8b39..7fffcd284 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -297,12 +297,12 @@ struct WireFeeInfo
/**
* When does the fee go into effect (inclusive).
*/
- struct GNUNET_TIME_Absolute start_date;
+ struct GNUNET_TIME_Timestamp start_date;
/**
* When does the fee stop being in effect (exclusive).
*/
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp end_date;
/**
* How high is the wire fee.
@@ -365,7 +365,7 @@ struct WireCheckContext
/**
* Execution time of the wire transfer.
*/
- struct GNUNET_TIME_Absolute date;
+ struct GNUNET_TIME_Timestamp date;
/**
* Database transaction status.
@@ -698,7 +698,7 @@ wire_transfer_information_cb (
uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_pay_uri,
- struct GNUNET_TIME_Absolute exec_time,
+ struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@@ -849,7 +849,9 @@ wire_transfer_information_cb (
rowid,
"target of outgoing wire transfer do not match hash of wire from deposit");
}
- if (exec_time.abs_value_us != wcc->date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (exec_time,
+ !=,
+ wcc->date) )
{
/* This should be impossible from database constraints */
GNUNET_break (0);
@@ -881,7 +883,7 @@ wire_transfer_information_cb (
static const struct TALER_Amount *
get_wire_fee (struct AggregationContext *ac,
const char *method,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct WireFeeInfo *wfi;
struct WireFeeInfo *pos;
@@ -890,10 +892,16 @@ get_wire_fee (struct AggregationContext *ac,
/* Check if fee is already loaded in cache */
for (pos = ac->fee_head; NULL != pos; pos = pos->next)
{
- if ( (pos->start_date.abs_value_us <= timestamp.abs_value_us) &&
- (pos->end_date.abs_value_us > timestamp.abs_value_us) )
+ if (GNUNET_TIME_timestamp_cmp (pos->start_date,
+ <=,
+ timestamp) &&
+ GNUNET_TIME_timestamp_cmp (pos->end_date,
+ >,
+ timestamp) )
return &pos->wire_fee;
- if (pos->start_date.abs_value_us > timestamp.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (pos->start_date,
+ >,
+ timestamp))
break;
}
@@ -929,7 +937,7 @@ get_wire_fee (struct AggregationContext *ac,
&master_sig))
{
report_row_inconsistency ("wire-fee",
- timestamp.abs_value_us,
+ timestamp.abs_time.abs_value_us,
"wire fee signature invalid at given time");
}
}
@@ -938,7 +946,7 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Wire fee is %s starting at %s\n",
TALER_amount2s (&wfi->wire_fee),
- GNUNET_STRINGS_absolute_time_to_string (wfi->start_date));
+ GNUNET_TIME_timestamp2s (wfi->start_date));
if ( (NULL == pos) ||
(NULL == pos->prev) )
GNUNET_CONTAINER_DLL_insert (ac->fee_head,
@@ -951,7 +959,9 @@ get_wire_fee (struct AggregationContext *ac,
wfi);
/* Check non-overlaping fee invariant */
if ( (NULL != wfi->prev) &&
- (wfi->prev->end_date.abs_value_us > wfi->start_date.abs_value_us) )
+ GNUNET_TIME_timestamp_cmp (wfi->prev->end_date,
+ >,
+ wfi->start_date) )
{
TALER_ARL_report (report_fee_time_inconsistencies,
GNUNET_JSON_PACK (
@@ -960,10 +970,12 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_JSON_pack_string ("diagnostic",
"start date before previous end date"),
TALER_JSON_pack_time_abs_human ("time",
- wfi->start_date)));
+ wfi->start_date.abs_time)));
}
if ( (NULL != wfi->next) &&
- (wfi->next->start_date.abs_value_us >= wfi->end_date.abs_value_us) )
+ GNUNET_TIME_timestamp_cmp (wfi->next->start_date,
+ >=,
+ wfi->end_date) )
{
TALER_ARL_report (report_fee_time_inconsistencies,
GNUNET_JSON_PACK (
@@ -972,7 +984,7 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_JSON_pack_string ("diagnostic",
"end date date after next start date"),
TALER_JSON_pack_time_abs_human ("time",
- wfi->end_date)));
+ wfi->end_date.abs_time)));
}
return &wfi->wire_fee;
}
@@ -993,7 +1005,7 @@ get_wire_fee (struct AggregationContext *ac,
static enum GNUNET_GenericReturnValue
check_wire_out_cb (void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount)
@@ -1013,7 +1025,7 @@ check_wire_out_cb (void *cls,
"Checking wire transfer %s over %s performed on %s\n",
TALER_B2S (wtid),
TALER_amount2s (amount),
- GNUNET_STRINGS_absolute_time_to_string (date));
+ GNUNET_TIME_timestamp2s (date));
if (NULL == (method = TALER_payto_get_method (payto_uri)))
{
report_row_inconsistency ("wire_out",
@@ -1062,7 +1074,7 @@ check_wire_out_cb (void *cls,
if (NULL == wire_fee)
{
report_row_inconsistency ("wire-fee",
- date.abs_value_us,
+ date.abs_time.abs_value_us,
"wire fee unavailable for given time");
/* If fee is unknown, we just assume the fee is zero */
final_amount = wcc.total_deposits;
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 4267cd0c2..937613cce 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -284,20 +284,21 @@ report_emergency_by_amount (
"Reporting emergency on denomination `%s' over loss of %s\n",
GNUNET_h2s (&issue->denom_hash.hash),
TALER_amount2s (loss));
- TALER_ARL_report (report_emergencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("denompub_hash",
- &issue->denom_hash),
- TALER_JSON_pack_amount ("denom_risk",
- risk),
- TALER_JSON_pack_amount ("denom_loss",
- loss),
- TALER_JSON_pack_time_abs_nbo_human ("start",
- issue->start),
- TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
- issue->expire_deposit),
- TALER_JSON_pack_amount_nbo ("value",
- &issue->value)));
+ TALER_ARL_report (
+ report_emergencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto ("denompub_hash",
+ &issue->denom_hash),
+ TALER_JSON_pack_amount ("denom_risk",
+ risk),
+ TALER_JSON_pack_amount ("denom_loss",
+ loss),
+ TALER_JSON_pack_time_abs_nbo_human ("start",
+ issue->start.abs_time_nbo),
+ TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
+ issue->expire_deposit.abs_time_nbo),
+ TALER_JSON_pack_amount_nbo ("value",
+ &issue->value)));
TALER_ARL_amount_add (&reported_emergency_risk_by_amount,
&reported_emergency_risk_by_amount,
risk);
@@ -330,22 +331,23 @@ report_emergency_by_count (
{
struct TALER_Amount denom_value;
- TALER_ARL_report (report_emergencies_by_count,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("denompub_hash",
- &issue->denom_hash),
- GNUNET_JSON_pack_uint64 ("num_issued",
- num_issued),
- GNUNET_JSON_pack_uint64 ("num_known",
- num_known),
- TALER_JSON_pack_amount ("denom_risk",
- risk),
- TALER_JSON_pack_time_abs_nbo_human ("start",
- issue->start),
- TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
- issue->expire_deposit),
- TALER_JSON_pack_amount_nbo ("value",
- &issue->value)));
+ TALER_ARL_report (
+ report_emergencies_by_count,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto ("denompub_hash",
+ &issue->denom_hash),
+ GNUNET_JSON_pack_uint64 ("num_issued",
+ num_issued),
+ GNUNET_JSON_pack_uint64 ("num_known",
+ num_known),
+ TALER_JSON_pack_amount ("denom_risk",
+ risk),
+ TALER_JSON_pack_time_abs_nbo_human ("start",
+ issue->start.abs_time_nbo),
+ TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
+ issue->expire_deposit.abs_time_nbo),
+ TALER_JSON_pack_amount_nbo ("value",
+ &issue->value)));
TALER_ARL_amount_add (&reported_emergency_risk_by_count,
&reported_emergency_risk_by_count,
risk);
@@ -794,7 +796,7 @@ get_denomination_summary (struct CoinContext *cc,
* @param value a `struct DenominationSummary`
* @return #GNUNET_OK (continue to iterate)
*/
-static int
+static enum GNUNET_GenericReturnValue
sync_denomination (void *cls,
const struct GNUNET_HashCode *denom_hash,
void *value)
@@ -806,16 +808,18 @@ sync_denomination (void *cls,
struct DenominationSummary *ds = value;
const struct TALER_DenominationKeyValidityPS *issue = ds->issue;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_TIME_Absolute expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_deposit;
struct GNUNET_TIME_Absolute expire_deposit_grace;
enum GNUNET_DB_QueryStatus qs;
now = GNUNET_TIME_absolute_get ();
- expire_deposit = GNUNET_TIME_absolute_ntoh (issue->expire_deposit);
+ expire_deposit = GNUNET_TIME_timestamp_ntoh (issue->expire_deposit);
/* add day grace period to deal with clocks not being perfectly synchronized */
- expire_deposit_grace = GNUNET_TIME_absolute_add (expire_deposit,
+ expire_deposit_grace = GNUNET_TIME_absolute_add (expire_deposit.abs_time,
DEPOSIT_GRACE_PERIOD);
- if (now.abs_value_us > expire_deposit_grace.abs_value_us)
+ if (GNUNET_TIME_absolute_cmp (now,
+ >,
+ expire_deposit_grace) )
{
/* Denomination key has expired, book remaining balance of
outstanding coins as revenue; and reduce cc->risk exposure. */
@@ -963,7 +967,7 @@ withdraw_cb (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee)
{
struct CoinContext *cc = cls;
@@ -1564,7 +1568,7 @@ refresh_session_cb (void *cls,
static enum GNUNET_GenericReturnValue
deposit_cb (void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit,
const struct TALER_DenominationPublicKey *denom_pub,
bool done)
@@ -1591,8 +1595,9 @@ deposit_cb (void *cls,
return GNUNET_SYSERR;
return GNUNET_OK;
}
- if (deposit->refund_deadline.abs_value_us >
- deposit->wire_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (deposit->refund_deadline,
+ >,
+ deposit->wire_deadline))
{
report_row_inconsistency ("deposits",
rowid,
@@ -2071,7 +2076,7 @@ check_recoup (struct CoinContext *cc,
static int
recoup_cb (void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@@ -2115,7 +2120,7 @@ recoup_cb (void *cls,
static int
recoup_refresh_cb (void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_DenominationHash *old_denom_pub_hash,
@@ -2211,8 +2216,8 @@ check_denomination (
struct TALER_Amount fee_deposit;
struct TALER_Amount fee_refresh;
struct TALER_Amount fee_refund;
- struct GNUNET_TIME_Absolute start;
- struct GNUNET_TIME_Absolute end;
+ struct GNUNET_TIME_Timestamp start;
+ struct GNUNET_TIME_Timestamp end;
(void) cls;
(void) denom_pub;
@@ -2226,8 +2231,8 @@ check_denomination (
&issue->fee_refresh);
TALER_amount_ntoh (&fee_refund,
&issue->fee_refund);
- start = GNUNET_TIME_absolute_ntoh (issue->start);
- end = GNUNET_TIME_absolute_ntoh (issue->expire_legal);
+ start = GNUNET_TIME_timestamp_ntoh (issue->start);
+ end = GNUNET_TIME_timestamp_ntoh (issue->expire_legal);
qs = TALER_ARL_edb->select_auditor_denom_sig (TALER_ARL_edb->cls,
&issue->denom_hash,
&TALER_ARL_auditor_pub,
@@ -2238,9 +2243,9 @@ check_denomination (
"Encountered denomination `%s' (%s) valid from %s (%llu-%llu) that this auditor is not auditing!\n",
GNUNET_h2s (&issue->denom_hash.hash),
TALER_amount2s (&coin_value),
- GNUNET_STRINGS_absolute_time_to_string (start),
- (unsigned long long) start.abs_value_us,
- (unsigned long long) end.abs_value_us);
+ GNUNET_TIME_timestamp2s (start),
+ (unsigned long long) start.abs_time.abs_value_us,
+ (unsigned long long) end.abs_time.abs_value_us);
return; /* skip! */
}
if (GNUNET_OK !=
@@ -2249,8 +2254,8 @@ check_denomination (
&issue->denom_hash,
&TALER_ARL_master_pub,
start,
- GNUNET_TIME_absolute_ntoh (issue->expire_withdraw),
- GNUNET_TIME_absolute_ntoh (issue->expire_deposit),
+ GNUNET_TIME_timestamp_ntoh (issue->expire_withdraw),
+ GNUNET_TIME_timestamp_ntoh (issue->expire_deposit),
end,
&coin_value,
&fee_withdraw,
@@ -2267,9 +2272,9 @@ check_denomination (
TALER_JSON_pack_amount ("value",
&coin_value),
TALER_JSON_pack_time_abs_human ("start_time",
- start),
+ start.abs_time),
TALER_JSON_pack_time_abs_human ("end_time",
- end)));
+ end.abs_time)));
}
}
diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c
index f7e1cb0dc..2499df2eb 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -112,7 +112,7 @@ test_dc (void *cls,
dcc->last_seen_coin_serial = serial_id;
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
struct TALER_Amount deposit_fee;
qs = TALER_ARL_edb->have_deposit2 (TALER_ARL_edb->cls,
@@ -140,16 +140,17 @@ test_dc (void *cls,
}
}
/* deposit confirmation missing! report! */
- TALER_ARL_report (report_deposit_confirmation_inconsistencies,
- GNUNET_JSON_PACK (
- TALER_JSON_pack_time_abs_human ("timestamp",
- dc->exchange_timestamp),
- TALER_JSON_pack_amount ("amount",
- &dc->amount_without_fee),
- GNUNET_JSON_pack_uint64 ("rowid",
- serial_id),
- GNUNET_JSON_pack_data_auto ("account",
- &dc->h_wire)));
+ TALER_ARL_report (
+ report_deposit_confirmation_inconsistencies,
+ GNUNET_JSON_PACK (
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ dc->exchange_timestamp.abs_time),
+ TALER_JSON_pack_amount ("amount",
+ &dc->amount_without_fee),
+ GNUNET_JSON_pack_uint64 ("rowid",
+ serial_id),
+ GNUNET_JSON_pack_data_auto ("account",
+ &dc->h_wire)));
dcc->first_missed_coin_serial = GNUNET_MIN (dcc->first_missed_coin_serial,
serial_id);
dcc->missed_count++;
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index 52a7b0748..2ce120202 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -284,7 +284,7 @@ struct ReserveSummary
* Previous reserve expiration data, as remembered by the auditor.
* (updated on-the-fly in #handle_reserve_in()).
*/
- struct GNUNET_TIME_Absolute a_expiration_date;
+ struct GNUNET_TIME_Timestamp a_expiration_date;
/**
* Which account did originally put money into the reserve?
@@ -408,12 +408,12 @@ handle_reserve_in (void *cls,
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
- struct GNUNET_TIME_Absolute execution_date)
+ struct GNUNET_TIME_Timestamp execution_date)
{
struct ReserveContext *rc = cls;
struct GNUNET_HashCode key;
struct ReserveSummary *rs;
- struct GNUNET_TIME_Absolute expiry;
+ struct GNUNET_TIME_Timestamp expiry;
enum GNUNET_DB_QueryStatus qs;
(void) wire_reference;
@@ -463,10 +463,11 @@ handle_reserve_in (void *cls,
"Additional incoming wire transfer for reserve `%s' of %s\n",
TALER_B2S (reserve_pub),
TALER_amount2s (credit));
- expiry = GNUNET_TIME_absolute_add (execution_date,
- idle_reserve_expiration_time);
- rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
- expiry);
+ expiry = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (execution_date.abs_time,
+ idle_reserve_expiration_time));
+ rs->a_expiration_date = GNUNET_TIME_timestamp_max (rs->a_expiration_date,
+ expiry);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
@@ -494,7 +495,7 @@ handle_reserve_out (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee)
{
struct ReserveContext *rc = cls;
@@ -504,8 +505,8 @@ handle_reserve_out (void *cls,
struct TALER_Amount withdraw_fee;
struct TALER_Amount auditor_value;
struct TALER_Amount auditor_amount_with_fee;
- struct GNUNET_TIME_Absolute valid_start;
- struct GNUNET_TIME_Absolute expire_withdraw;
+ struct GNUNET_TIME_Timestamp valid_start;
+ struct GNUNET_TIME_Timestamp expire_withdraw;
enum GNUNET_DB_QueryStatus qs;
struct TALER_WithdrawRequestPS wsrd = {
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW),
@@ -545,22 +546,26 @@ handle_reserve_out (void *cls,
}
/* check that execution date is within withdraw range for denom_pub */
- valid_start = GNUNET_TIME_absolute_ntoh (issue->start);
- expire_withdraw = GNUNET_TIME_absolute_ntoh (issue->expire_withdraw);
+ valid_start = GNUNET_TIME_timestamp_ntoh (issue->start);
+ expire_withdraw = GNUNET_TIME_timestamp_ntoh (issue->expire_withdraw);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Checking withdraw timing: %llu, expire: %llu, timing: %llu\n",
- (unsigned long long) valid_start.abs_value_us,
- (unsigned long long) expire_withdraw.abs_value_us,
- (unsigned long long) execution_date.abs_value_us);
- if ( (valid_start.abs_value_us > execution_date.abs_value_us) ||
- (expire_withdraw.abs_value_us < execution_date.abs_value_us) )
+ (unsigned long long) valid_start.abs_time.abs_value_us,
+ (unsigned long long) expire_withdraw.abs_time.abs_value_us,
+ (unsigned long long) execution_date.abs_time.abs_value_us);
+ if (GNUNET_TIME_timestamp_cmp (valid_start,
+ >,
+ execution_date) ||
+ GNUNET_TIME_timestamp_cmp (expire_withdraw,
+ <,
+ execution_date))
{
TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_time_abs_human ("execution_date",
- execution_date),
+ execution_date.abs_time),
GNUNET_JSON_pack_data_auto ("reserve_pub",
reserve_pub),
GNUNET_JSON_pack_data_auto ("denompub_h",
@@ -683,7 +688,7 @@ static int
handle_recoup_by_reserve (
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@@ -694,7 +699,7 @@ handle_recoup_by_reserve (
struct ReserveContext *rc = cls;
struct GNUNET_HashCode key;
struct ReserveSummary *rs;
- struct GNUNET_TIME_Absolute expiry;
+ struct GNUNET_TIME_Timestamp expiry;
struct TALER_MasterSignatureP msig;
uint64_t rev_rowid;
enum GNUNET_DB_QueryStatus qs;
@@ -845,10 +850,11 @@ handle_recoup_by_reserve (
"Additional /recoup value to for reserve `%s' of %s\n",
TALER_B2S (reserve_pub),
TALER_amount2s (amount));
- expiry = GNUNET_TIME_absolute_add (timestamp,
- idle_reserve_expiration_time);
- rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
- expiry);
+ expiry = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (timestamp.abs_time,
+ idle_reserve_expiration_time));
+ rs->a_expiration_date = GNUNET_TIME_timestamp_max (rs->a_expiration_date,
+ expiry);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
@@ -864,14 +870,14 @@ handle_recoup_by_reserve (
* @param[out] fee set to the closing fee
* @return #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
get_closing_fee (const char *receiver_account,
- struct GNUNET_TIME_Absolute atime,
+ struct GNUNET_TIME_Timestamp atime,
struct TALER_Amount *fee)
{
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_Amount wire_fee;
char *method;
@@ -894,9 +900,9 @@ get_closing_fee (const char *receiver_account,
GNUNET_asprintf (&diag,
"closing fee for `%s' unavailable at %s\n",
method,
- GNUNET_STRINGS_absolute_time_to_string (atime));
+ GNUNET_TIME_timestamp2s (atime));
report_row_inconsistency ("closing-fee",
- atime.abs_value_us,
+ atime.abs_time.abs_value_us,
diag);
GNUNET_free (diag);
GNUNET_free (method);
@@ -925,7 +931,7 @@ static int
handle_reserve_closed (
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
@@ -1155,8 +1161,10 @@ verify_reserve_balance (void *cls,
/* Check that reserve is being closed if it is past its expiration date
(and the closing fee would not exceed the remaining balance) */
- if (CLOSING_GRACE_PERIOD.rel_value_us <
- GNUNET_TIME_absolute_get_duration (rs->a_expiration_date).rel_value_us)
+ if (GNUNET_TIME_relative_cmp (CLOSING_GRACE_PERIOD,
+ <,
+ GNUNET_TIME_absolute_get_duration (
+ rs->a_expiration_date.abs_time)))
{
/* Reserve is expired */
struct TALER_Amount cfee;
@@ -1183,7 +1191,7 @@ verify_reserve_balance (void *cls,
TALER_JSON_pack_amount ("balance",
&nbalance),
TALER_JSON_pack_time_abs_human ("expiration_time",
- rs->a_expiration_date)));
+ rs->a_expiration_date.abs_time)));
}
}
else
@@ -1192,16 +1200,17 @@ verify_reserve_balance (void *cls,
TALER_ARL_amount_add (&total_balance_reserve_not_closed,
&total_balance_reserve_not_closed,
&nbalance);
- TALER_ARL_report (report_reserve_not_closed_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rs->reserve_pub),
- TALER_JSON_pack_amount ("balance",
- &nbalance),
- TALER_JSON_pack_time_abs_human ("expiration_time",
- rs->a_expiration_date),
- GNUNET_JSON_pack_string ("diagnostic",
- "could not determine closing fee")));
+ TALER_ARL_report (
+ report_reserve_not_closed_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &rs->reserve_pub),
+ TALER_JSON_pack_amount ("balance",
+ &nbalance),
+ TALER_JSON_pack_time_abs_human ("expiration_time",
+ rs->a_expiration_date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "could not determine closing fee")));
}
}
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c
index f275a453b..89758c2fc 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -122,7 +122,7 @@ struct ReserveClosure
/**
* When was the reserve closed?
*/
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
/**
* Amount transferred (amount remaining minus fee).
@@ -500,9 +500,9 @@ do_shutdown (void *cls)
GNUNET_JSON_pack_uint64 ("end_pp_reserve_close_uuid",
pp.last_reserve_close_uuid),
TALER_JSON_pack_time_abs_human ("start_pp_last_timestamp",
- start_pp.last_timestamp),
+ start_pp.last_timestamp.abs_time),
TALER_JSON_pack_time_abs_human ("end_pp_last_timestamp",
- pp.last_timestamp),
+ pp.last_timestamp.abs_time),
GNUNET_JSON_pack_array_steal ("account_progress",
report_account_progress)));
report_wire_out_inconsistencies = NULL;
@@ -599,18 +599,19 @@ check_pending_rc (void *cls,
&rc->amount);
if ( (0 != rc->amount.value) ||
(0 != rc->amount.fraction) )
- TALER_ARL_report (report_closure_lags,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rc->rowid),
- TALER_JSON_pack_amount ("amount",
- &rc->amount),
- TALER_JSON_pack_time_abs_human ("deadline",
- rc->execution_date),
- GNUNET_JSON_pack_data_auto ("wtid",
- &rc->wtid),
- GNUNET_JSON_pack_string ("account",
- rc->receiver_account)));
+ TALER_ARL_report (
+ report_closure_lags,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rc->rowid),
+ TALER_JSON_pack_amount ("amount",
+ &rc->amount),
+ TALER_JSON_pack_time_abs_human ("deadline",
+ rc->execution_date.abs_time),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ &rc->wtid),
+ GNUNET_JSON_pack_string ("account",
+ rc->receiver_account)));
pp.last_reserve_close_uuid
= GNUNET_MIN (pp.last_reserve_close_uuid,
rc->rowid);
@@ -731,7 +732,7 @@ commit (enum GNUNET_DB_QueryStatus qs)
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Concluded audit step at %s\n",
- GNUNET_STRINGS_absolute_time_to_string (pp.last_timestamp));
+ GNUNET_TIME_timestamp2s (pp.last_timestamp));
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
@@ -788,7 +789,7 @@ wire_missing_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount,
const char *payto_uri,
- struct GNUNET_TIME_Absolute deadline,
+ struct GNUNET_TIME_Timestamp deadline,
bool tiny,
bool done)
{
@@ -821,7 +822,7 @@ wire_missing_cb (void *cls,
TALER_JSON_pack_amount ("amount",
amount),
TALER_JSON_pack_time_abs_human ("deadline",
- deadline),
+ deadline.abs_time),
GNUNET_JSON_pack_data_auto ("coin_pub",
coin_pub),
GNUNET_JSON_pack_string ("account",
@@ -846,18 +847,17 @@ wire_missing_cb (void *cls,
static void
check_for_required_transfers (void)
{
- struct GNUNET_TIME_Absolute next_timestamp;
+ struct GNUNET_TIME_Timestamp next_timestamp;
enum GNUNET_DB_QueryStatus qs;
- next_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&next_timestamp);
/* Subtract #GRACE_PERIOD, so we can be a bit behind in processing
without immediately raising undue concern */
- next_timestamp = GNUNET_TIME_absolute_subtract (next_timestamp,
- GRACE_PERIOD);
+ next_timestamp = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (),
+ GRACE_PERIOD));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange's unfinished deposits (deadline: %s)\n",
- GNUNET_STRINGS_absolute_time_to_string (next_timestamp));
+ GNUNET_TIME_timestamp2s (next_timestamp));
qs = TALER_ARL_edb->select_deposits_missing_wire (TALER_ARL_edb->cls,
pp.last_timestamp,
next_timestamp,
@@ -903,25 +903,27 @@ conclude_wire_out (void)
static void
check_time_difference (const char *table,
uint64_t rowid,
- struct GNUNET_TIME_Absolute want,
- struct GNUNET_TIME_Absolute have)
+ struct GNUNET_TIME_Timestamp want,
+ struct GNUNET_TIME_Timestamp have)
{
struct GNUNET_TIME_Relative delta;
char *details;
- if (have.abs_value_us > want.abs_value_us)
- delta = GNUNET_TIME_absolute_get_difference (want,
- have);
+ if (GNUNET_TIME_timestamp_cmp (have, >, want))
+ delta = GNUNET_TIME_absolute_get_difference (want.abs_time,
+ have.abs_time);
else
- delta = GNUNET_TIME_absolute_get_difference (have,
- want);
- if (delta.rel_value_us <= TIME_TOLERANCE.rel_value_us)
+ delta = GNUNET_TIME_absolute_get_difference (have.abs_time,
+ want.abs_time);
+ if (GNUNET_TIME_relative_cmp (delta,
+ <=,
+ TIME_TOLERANCE))
return;
GNUNET_asprintf (&details,
"execution date mismatch (%s)",
- GNUNET_STRINGS_relative_time_to_string (delta,
- GNUNET_YES));
+ GNUNET_TIME_relative2s (delta,
+ true));
TALER_ARL_report (report_row_minor_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@@ -949,7 +951,7 @@ check_time_difference (const char *table,
static enum GNUNET_GenericReturnValue
wire_out_cb (void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount)
@@ -960,7 +962,7 @@ wire_out_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Exchange wire OUT at %s of %s with WTID %s\n",
- GNUNET_STRINGS_absolute_time_to_string (date),
+ GNUNET_TIME_timestamp2s (date),
TALER_amount2s (amount),
TALER_B2S (wtid));
GNUNET_CRYPTO_hash (wtid,
@@ -974,22 +976,23 @@ wire_out_cb (void *cls,
justified), so the entire amount is missing / still to be done.
This is moderately harmless, it might just be that the aggreator
has not yet fully caught up with the transfers it should do. */
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- TALER_JSON_pack_amount ("amount_justified",
- amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire transfer not made (yet?)"),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
+ TALER_ARL_report (
+ report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rowid),
+ TALER_JSON_pack_amount ("amount_wired",
+ &zero),
+ TALER_JSON_pack_amount ("amount_justified",
+ amount),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "wire transfer not made (yet?)"),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name)));
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
@@ -1003,45 +1006,48 @@ wire_out_cb (void *cls,
/* Destination bank account is wrong in actual wire transfer, so
we should count the wire transfer as entirely spurious, and
additionally consider the justified wire transfer as missing. */
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_justified",
- &zero),
- GNUNET_JSON_pack_data_auto ("wtid", wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date),
- GNUNET_JSON_pack_string ("diagnostic",
- "receiver account mismatch"),
- GNUNET_JSON_pack_string ("target",
- payto_uri),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
+ TALER_ARL_report (
+ report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rowid),
+ TALER_JSON_pack_amount ("amount_wired",
+ &roi->details.amount),
+ TALER_JSON_pack_amount ("amount_justified",
+ &zero),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "receiver account mismatch"),
+ GNUNET_JSON_pack_string ("target",
+ payto_uri),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name)));
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount);
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- TALER_JSON_pack_amount ("amount_justified",
- amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date),
- GNUNET_JSON_pack_string ("diagnostic",
- "receiver account mismatch"),
- GNUNET_JSON_pack_string ("target",
- roi->details.
- credit_account_uri),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
+ TALER_ARL_report (
+ report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rowid),
+ TALER_JSON_pack_amount ("amount_wired",
+ &zero),
+ TALER_JSON_pack_amount ("amount_justified",
+ amount),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "receiver account mismatch"),
+ GNUNET_JSON_pack_string ("target",
+ roi->details.
+ credit_account_uri),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name)));
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
@@ -1050,22 +1056,23 @@ wire_out_cb (void *cls,
if (0 != TALER_amount_cmp (&roi->details.amount,
amount))
{
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_justified",
- amount),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire amount does not match"),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
+ TALER_ARL_report (
+ report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rowid),
+ TALER_JSON_pack_amount ("amount_justified",
+ amount),
+ TALER_JSON_pack_amount ("amount_wired",
+ &roi->details.amount),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "wire amount does not match"),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name)));
if (0 < TALER_amount_cmp (amount,
&roi->details.amount))
{
@@ -1197,23 +1204,23 @@ complain_out_not_found (void *cls,
&ctx);
if (ctx.found)
return GNUNET_OK;
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- 0),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_justified",
- &zero),
- GNUNET_JSON_pack_data_auto ("wtid",
- &roi->details.wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- roi->details.
- execution_date),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name),
- GNUNET_JSON_pack_string ("diagnostic",
- "justification for wire transfer not found")));
+ TALER_ARL_report (
+ report_wire_out_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ 0),
+ TALER_JSON_pack_amount ("amount_wired",
+ &roi->details.amount),
+ TALER_JSON_pack_amount ("amount_justified",
+ &zero),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ &roi->details.wtid),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ roi->details.execution_date.abs_time),
+ GNUNET_JSON_pack_string ("account_section",
+ wa->ai->section_name),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "justification for wire transfer not found")));
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount);
@@ -1316,7 +1323,7 @@ history_debit_cb (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing bank DEBIT at %s of %s with WTID %s\n",
- GNUNET_STRINGS_absolute_time_to_string (details->execution_date),
+ GNUNET_TIME_timestamp2s (details->execution_date),
TALER_amount2s (&details->amount),
TALER_B2S (&details->wtid));
/* Update offset */
@@ -1459,7 +1466,7 @@ reserve_in_cb (void *cls,
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
- struct GNUNET_TIME_Absolute execution_date)
+ struct GNUNET_TIME_Timestamp execution_date)
{
struct WireAccount *wa = cls;
struct ReserveInInfo *rii;
@@ -1468,7 +1475,7 @@ reserve_in_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange wire IN (%llu) at %s of %s with reserve_pub %s\n",
(unsigned long long) rowid,
- GNUNET_STRINGS_absolute_time_to_string (execution_date),
+ GNUNET_TIME_timestamp2s (execution_date),
TALER_amount2s (credit),
TALER_B2S (reserve_pub));
slen = strlen (sender_account_details) + 1;
@@ -1529,23 +1536,23 @@ complain_in_not_found (void *cls,
struct ReserveInInfo *rii = value;
(void) key;
- TALER_ARL_report (report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &rii->details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rii->details.reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- rii->details.
- execution_date),
- GNUNET_JSON_pack_string ("account",
- wa->ai->section_name),
- GNUNET_JSON_pack_string ("diagnostic",
- "incoming wire transfer claimed by exchange not found")));
+ TALER_ARL_report (
+ report_reserve_in_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rii->rowid),
+ TALER_JSON_pack_amount ("amount_exchange_expected",
+ &rii->details.amount),
+ TALER_JSON_pack_amount ("amount_wired",
+ &zero),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &rii->details.reserve_pub),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ rii->details.execution_date.abs_time),
+ GNUNET_JSON_pack_string ("account",
+ wa->ai->section_name),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "incoming wire transfer claimed by exchange not found")));
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount);
@@ -1620,7 +1627,7 @@ history_credit_cb (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing bank CREDIT at %s of %s with Reserve-pub %s\n",
- GNUNET_STRINGS_absolute_time_to_string (details->execution_date),
+ GNUNET_TIME_timestamp2s (details->execution_date),
TALER_amount2s (&details->amount),
TALER_B2S (&details->reserve_pub));
GNUNET_CRYPTO_hash (&row_off,
@@ -1632,8 +1639,7 @@ history_credit_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to find wire transfer at `%s' in exchange database. Audit ends at this point in time.\n",
- GNUNET_STRINGS_absolute_time_to_string (
- details->execution_date));
+ GNUNET_TIME_timestamp2s (details->execution_date));
wa->chh = NULL;
process_credits (wa->next);
return GNUNET_SYSERR; /* not an error, just end of processing */
@@ -1645,42 +1651,43 @@ history_credit_cb (void *cls,
if (0 != GNUNET_memcmp (&details->reserve_pub,
&rii->details.reserve_pub))
{
- TALER_ARL_report (report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- row_off),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &rii->details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rii->details.reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- rii->details.
- execution_date),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire subject does not match")));
+ TALER_ARL_report (
+ report_reserve_in_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rii->rowid),
+ GNUNET_JSON_pack_uint64 ("bank_row",
+ row_off),
+ TALER_JSON_pack_amount ("amount_exchange_expected",
+ &rii->details.amount),
+ TALER_JSON_pack_amount ("amount_wired",
+ &zero),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &rii->details.reserve_pub),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ rii->details.execution_date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "wire subject does not match")));
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount);
- TALER_ARL_report (report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- row_off),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &zero),
- TALER_JSON_pack_amount ("amount_wired",
- &details->amount),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &details->reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- details->execution_date),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire subject does not match")));
+ TALER_ARL_report (
+ report_reserve_in_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rii->rowid),
+ GNUNET_JSON_pack_uint64 ("bank_row",
+ row_off),
+ TALER_JSON_pack_amount ("amount_exchange_expected",
+ &zero),
+ TALER_JSON_pack_amount ("amount_wired",
+ &details->amount),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &details->reserve_pub),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ details->execution_date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "wire subject does not match")));
TALER_ARL_amount_add (&total_bad_amount_in_plus,
&total_bad_amount_in_plus,
@@ -1690,22 +1697,23 @@ history_credit_cb (void *cls,
if (0 != TALER_amount_cmp (&rii->details.amount,
&details->amount))
{
- TALER_ARL_report (report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- row_off),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &rii->details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &details->amount),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &details->reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- details->execution_date),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire amount does not match")));
+ TALER_ARL_report (
+ report_reserve_in_inconsistencies,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row",
+ rii->rowid),
+ GNUNET_JSON_pack_uint64 ("bank_row",
+ row_off),
+ TALER_JSON_pack_amount ("amount_exchange_expected",
+ &rii->details.amount),
+ TALER_JSON_pack_amount ("amount_wired",
+ &details->amount),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &details->reserve_pub),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ details->execution_date.abs_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ "wire amount does not match")));
if (0 < TALER_amount_cmp (&details->amount,
&rii->details.amount))
{
@@ -1751,8 +1759,9 @@ history_credit_cb (void *cls,
&total_missattribution_in,
&rii->details.amount);
}
- if (details->execution_date.abs_value_us !=
- rii->details.execution_date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (details->execution_date,
+ !=,
+ rii->details.execution_date))
{
TALER_ARL_report (report_row_minor_inconsistencies,
GNUNET_JSON_PACK (
@@ -1868,7 +1877,7 @@ begin_credit_audit (void)
static int
reserve_closed_cb (void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
@@ -1996,7 +2005,7 @@ begin_transaction (void)
start_pp = pp;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Resuming wire audit at %s / %llu\n",
- GNUNET_STRINGS_absolute_time_to_string (pp.last_timestamp),
+ GNUNET_TIME_timestamp2s (pp.last_timestamp),
(unsigned long long) pp.last_reserve_close_uuid);
}
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c
index 5817c880b..7931900a5 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -792,13 +792,13 @@ postgres_commit (void *cls)
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on DB errors
*/
-static int
+static enum GNUNET_GenericReturnValue
postgres_gc (void *cls)
{
struct PostgresClosure *pg = cls;
struct GNUNET_TIME_Absolute now;
struct GNUNET_PQ_QueryParam params_time[] = {
- TALER_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_Context *conn;
@@ -1003,9 +1003,9 @@ postgres_insert_exchange_signkey (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&sk->master_public_key),
- TALER_PQ_query_param_absolute_time (&sk->ep_start),
- TALER_PQ_query_param_absolute_time (&sk->ep_expire),
- TALER_PQ_query_param_absolute_time (&sk->ep_end),
+ GNUNET_PQ_query_param_timestamp (&sk->ep_start),
+ GNUNET_PQ_query_param_timestamp (&sk->ep_expire),
+ GNUNET_PQ_query_param_timestamp (&sk->ep_end),
GNUNET_PQ_query_param_auto_from_type (&sk->exchange_pub),
GNUNET_PQ_query_param_auto_from_type (&sk->master_sig),
GNUNET_PQ_query_param_end
@@ -1035,9 +1035,9 @@ postgres_insert_deposit_confirmation (
GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (&dc->h_extensions),
GNUNET_PQ_query_param_auto_from_type (&dc->h_wire),
- TALER_PQ_query_param_absolute_time (&dc->exchange_timestamp),
- TALER_PQ_query_param_absolute_time (&dc->wire_deadline),
- TALER_PQ_query_param_absolute_time (&dc->refund_deadline),
+ GNUNET_PQ_query_param_timestamp (&dc->exchange_timestamp),
+ GNUNET_PQ_query_param_timestamp (&dc->wire_deadline),
+ GNUNET_PQ_query_param_timestamp (&dc->refund_deadline),
TALER_PQ_query_param_amount (&dc->amount_without_fee),
GNUNET_PQ_query_param_auto_from_type (&dc->coin_pub),
GNUNET_PQ_query_param_auto_from_type (&dc->merchant),
@@ -1118,12 +1118,12 @@ deposit_confirmation_cb (void *cls,
&dc.h_extensions),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&dc.h_wire),
- GNUNET_PQ_result_spec_absolute_time ("exchange_timestamp",
- &dc.exchange_timestamp),
- GNUNET_PQ_result_spec_absolute_time ("refund_deadline",
- &dc.refund_deadline),
- GNUNET_PQ_result_spec_absolute_time ("wire_deadline",
- &dc.wire_deadline),
+ GNUNET_PQ_result_spec_timestamp ("exchange_timestamp",
+ &dc.exchange_timestamp),
+ GNUNET_PQ_result_spec_timestamp ("refund_deadline",
+ &dc.refund_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ &dc.wire_deadline),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_without_fee",
&dc.amount_without_fee),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@@ -1726,7 +1726,7 @@ postgres_insert_wire_auditor_progress (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
- TALER_PQ_query_param_absolute_time (&pp->last_timestamp),
+ GNUNET_PQ_query_param_timestamp (&pp->last_timestamp),
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_uuid),
GNUNET_PQ_query_param_end
};
@@ -1754,7 +1754,7 @@ postgres_update_wire_auditor_progress (
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- TALER_PQ_query_param_absolute_time (&pp->last_timestamp),
+ GNUNET_PQ_query_param_timestamp (&pp->last_timestamp),
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_uuid),
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end
@@ -1786,8 +1786,8 @@ postgres_get_wire_auditor_progress (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("last_timestamp",
- &pp->last_timestamp),
+ GNUNET_PQ_result_spec_timestamp ("last_timestamp",
+ &pp->last_timestamp),
GNUNET_PQ_result_spec_uint64 ("last_reserve_close_uuid",
&pp->last_reserve_close_uuid),
GNUNET_PQ_result_spec_end
@@ -1820,7 +1820,7 @@ postgres_insert_reserve_info (void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
- struct GNUNET_TIME_Absolute expiration_date,
+ struct GNUNET_TIME_Timestamp expiration_date,
const char *origin_account)
{
struct PostgresClosure *pg = cls;
@@ -1829,7 +1829,7 @@ postgres_insert_reserve_info (void *cls,
GNUNET_PQ_query_param_auto_from_type (master_pub),
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
- TALER_PQ_query_param_absolute_time (&expiration_date),
+ GNUNET_PQ_query_param_timestamp (&expiration_date),
GNUNET_PQ_query_param_string (origin_account),
GNUNET_PQ_query_param_end
};
@@ -1863,13 +1863,13 @@ postgres_update_reserve_info (void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
- struct GNUNET_TIME_Absolute expiration_date)
+ struct GNUNET_TIME_Timestamp expiration_date)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
- TALER_PQ_query_param_absolute_time (&expiration_date),
+ GNUNET_PQ_query_param_timestamp (&expiration_date),
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end
@@ -1932,7 +1932,7 @@ postgres_get_reserve_info (void *cls,
uint64_t *rowid,
struct TALER_Amount *reserve_balance,
struct TALER_Amount *withdraw_fee_balance,
- struct GNUNET_TIME_Absolute *expiration_date,
+ struct GNUNET_TIME_Timestamp *expiration_date,
char **sender_account)
{
struct PostgresClosure *pg = cls;
@@ -1944,7 +1944,7 @@ postgres_get_reserve_info (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_balance", reserve_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("withdraw_fee_balance", withdraw_fee_balance),
- TALER_PQ_result_spec_absolute_time ("expiration_date", expiration_date),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date", expiration_date),
GNUNET_PQ_result_spec_uint64 ("auditor_reserves_rowid", rowid),
GNUNET_PQ_result_spec_string ("origin_account", sender_account),
GNUNET_PQ_result_spec_end
@@ -2440,7 +2440,7 @@ postgres_insert_historic_denom_revenue (
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_DenominationHash *denom_pub_hash,
- struct GNUNET_TIME_Absolute revenue_timestamp,
+ struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *loss_balance)
{
@@ -2448,7 +2448,7 @@ postgres_insert_historic_denom_revenue (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
- TALER_PQ_query_param_absolute_time (&revenue_timestamp),
+ GNUNET_PQ_query_param_timestamp (&revenue_timestamp),
TALER_PQ_query_param_amount (revenue_balance),
TALER_PQ_query_param_amount (loss_balance),
GNUNET_PQ_query_param_end
@@ -2507,15 +2507,18 @@ historic_denom_revenue_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
struct TALER_DenominationHash denom_pub_hash;
- struct GNUNET_TIME_Absolute revenue_timestamp;
+ struct GNUNET_TIME_Timestamp revenue_timestamp;
struct TALER_Amount revenue_balance;
struct TALER_Amount loss;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &denom_pub_hash),
- TALER_PQ_result_spec_absolute_time ("revenue_timestamp",
- &revenue_timestamp),
- TALER_PQ_RESULT_SPEC_AMOUNT ("revenue_balance", &revenue_balance),
- TALER_PQ_RESULT_SPEC_AMOUNT ("loss_balance", &loss),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &denom_pub_hash),
+ GNUNET_PQ_result_spec_timestamp ("revenue_timestamp",
+ &revenue_timestamp),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("revenue_balance",
+ &revenue_balance),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("loss_balance",
+ &loss),
GNUNET_PQ_result_spec_end
};
@@ -2595,15 +2598,15 @@ static enum GNUNET_DB_QueryStatus
postgres_insert_historic_reserve_revenue (
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *reserve_profits)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
- TALER_PQ_query_param_absolute_time (&start_time),
- TALER_PQ_query_param_absolute_time (&end_time),
+ GNUNET_PQ_query_param_timestamp (&start_time),
+ GNUNET_PQ_query_param_timestamp (&end_time),
TALER_PQ_query_param_amount (reserve_profits),
GNUNET_PQ_query_param_end
};
@@ -2660,13 +2663,16 @@ historic_reserve_revenue_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_Amount reserve_profits;
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("start_date", &start_date),
- TALER_PQ_result_spec_absolute_time ("end_date", &end_date),
- TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_profits", &reserve_profits),
+ GNUNET_PQ_result_spec_timestamp ("start_date",
+ &start_date),
+ GNUNET_PQ_result_spec_timestamp ("end_date",
+ &end_date),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_profits",
+ &reserve_profits),
GNUNET_PQ_result_spec_end
};
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index d1a05297d..77b1a38e4 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -75,12 +75,12 @@ handle_admin_add_incoming_finished (void *cls,
{
struct TALER_BANK_AdminAddIncomingHandle *aai = cls;
uint64_t row_id = UINT64_MAX;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
enum TALER_ErrorCode ec;
const json_t *j = response;
aai->job = NULL;
- timestamp = GNUNET_TIME_UNIT_FOREVER_ABS;
+ timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
switch (response_code)
{
case 0:
@@ -91,8 +91,8 @@ handle_admin_add_incoming_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_end ()
};
@@ -158,23 +158,6 @@ handle_admin_add_incoming_finished (void *cls,
}
-/**
- * Perform a wire transfer from some account to the exchange to fill a
- * reserve. Note that this API is usually only used for testing (with
- * fakebank and our Python bank) and thus may not be accessible in a
- * production setting.
- *
- * @param ctx curl context for the event loop
- * @param auth authentication data to send to the bank
- * @param reserve_pub wire transfer subject for the transfer
- * @param amount amount that was is to be deposited
- * @param debit_account account to deposit from (payto URI, but used as 'payfrom')
- * @param res_cb the callback to call when the final result for this request is available
- * @param res_cb_cls closure for the above callback
- * @return NULL
- * if the inputs are invalid (i.e. invalid amount) or internal errors.
- * In this case, the callback is not called.
- */
struct TALER_BANK_AdminAddIncomingHandle *
TALER_BANK_admin_add_incoming (
struct GNUNET_CURL_Context *ctx,
@@ -268,12 +251,6 @@ TALER_BANK_admin_add_incoming (
}
-/**
- * Cancel an add incoming. This function cannot be used on a request
- * handle if a response is already served for it.
- *
- * @param aai the admin add incoming request handle
- */
void
TALER_BANK_admin_add_incoming_cancel (
struct TALER_BANK_AdminAddIncomingHandle *aai)
diff --git a/src/bank-lib/bank_api_common.c b/src/bank-lib/bank_api_common.c
index abdeee31a..f749e0a92 100644
--- a/src/bank-lib/bank_api_common.c
+++ b/src/bank-lib/bank_api_common.c
@@ -23,15 +23,6 @@
#include "bank_api_common.h"
-/**
- * Set authentication data in @a easy from @a auth.
- * The API currently specifies the use of HTTP basic
- * authentication.
- *
- * @param easy curl handle to setup for authentication
- * @param auth authentication data to use
- * @return #GNUNET_OK in success
- */
int
TALER_BANK_setup_auth_ (CURL *easy,
const struct TALER_BANK_AuthenticationData *auth)
diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c
index eff2ad971..1ea2e269e 100644
--- a/src/bank-lib/bank_api_credit.c
+++ b/src/bank-lib/bank_api_credit.c
@@ -97,8 +97,8 @@ parse_account_history (struct TALER_BANK_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_fixed_auto ("reserve_pub",
diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c
index 339dfef40..2a76495bd 100644
--- a/src/bank-lib/bank_api_debit.c
+++ b/src/bank-lib/bank_api_debit.c
@@ -73,7 +73,7 @@ struct TALER_BANK_DebitHistoryHandle
* were set,
* #GNUNET_SYSERR if there was a protocol violation in @a history
*/
-static int
+static enum GNUNET_GenericReturnValue
parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
const json_t *history)
{
@@ -97,8 +97,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *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_fixed_auto ("wtid",
diff --git a/src/bank-lib/bank_api_parse.c b/src/bank-lib/bank_api_parse.c
index b09e5af35..0d30e9d08 100644
--- a/src/bank-lib/bank_api_parse.c
+++ b/src/bank-lib/bank_api_parse.c
@@ -23,15 +23,7 @@
#include "taler_bank_service.h"
-/**
- * Parse configuration section with bank authentication data.
- *
- * @param cfg configuration to parse
- * @param section the section with the configuration data
- * @param[out] auth set to the configuration data found
- * @return #GNUNET_OK on success
- */
-int
+enum GNUNET_GenericReturnValue
TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section,
struct TALER_BANK_AuthenticationData *auth)
@@ -122,12 +114,6 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
-/**
- * Free memory inside of @a auth (but not @a auth itself).
- * Dual to #TALER_BANK_auth_parse_cfg().
- *
- * @param[in] auth authentication data to free
- */
void
TALER_BANK_auth_free (struct TALER_BANK_AuthenticationData *auth)
{
diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c
index 7b8c74b24..bbfc9cec8 100644
--- a/src/bank-lib/bank_api_transfer.c
+++ b/src/bank-lib/bank_api_transfer.c
@@ -170,7 +170,7 @@ handle_transfer_finished (void *cls,
struct TALER_BANK_TransferHandle *th = cls;
const json_t *j = response;
uint64_t row_id = UINT64_MAX;
- struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_UNIT_FOREVER_ABS;
+ struct GNUNET_TIME_Timestamp timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
enum TALER_ErrorCode ec;
th->job = NULL;
@@ -184,8 +184,8 @@ handle_transfer_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_end ()
};
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 6549a288d..2ccc2c751 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -219,7 +219,7 @@ struct Transaction
/**
* When did the transaction happen?
*/
- struct GNUNET_TIME_Absolute date;
+ struct GNUNET_TIME_Timestamp date;
/**
* Number of this transaction.
@@ -963,7 +963,7 @@ make_transfer (
const char *exchange_base_url,
const struct GNUNET_HashCode *request_uid,
uint64_t *ret_row_id,
- struct GNUNET_TIME_Absolute *timestamp)
+ struct GNUNET_TIME_Timestamp *timestamp)
{
struct Transaction *t;
struct Account *debit_acc;
@@ -1022,9 +1022,9 @@ make_transfer (
t->debit_account = debit_acc;
t->credit_account = credit_acc;
t->amount = *amount;
- t->date = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&t->date);
- *timestamp = t->date;
+ t->date = GNUNET_TIME_timestamp_get ();
+ if (NULL != timestamp)
+ *timestamp = t->date;
t->type = T_DEBIT;
memcpy (t->subject.debit.exchange_base_url,
exchange_base_url,
@@ -1082,7 +1082,7 @@ make_admin_transfer (
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
uint64_t *row_id,
- struct GNUNET_TIME_Absolute *timestamp)
+ struct GNUNET_TIME_Timestamp *timestamp)
{
struct Transaction *t;
const struct GNUNET_PeerIdentity *pid;
@@ -1125,8 +1125,7 @@ make_admin_transfer (
t->debit_account = debit_acc;
t->credit_account = credit_acc;
t->amount = *amount;
- t->date = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&t->date);
+ t->date = GNUNET_TIME_timestamp_get ();
if (NULL != timestamp)
*timestamp = t->date;
t->type = T_CREDIT;
@@ -1334,7 +1333,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
enum GNUNET_JSON_PostResult pr;
json_t *json;
uint64_t row_id;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
connection,
@@ -1431,8 +1430,8 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_OK,
GNUNET_JSON_pack_uint64 ("row_id",
row_id),
- GNUNET_JSON_pack_time_abs ("timestamp",
- timestamp));
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ timestamp));
}
@@ -1458,7 +1457,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
enum GNUNET_JSON_PostResult pr;
json_t *json;
uint64_t row_id;
- struct GNUNET_TIME_Absolute ts;
+ struct GNUNET_TIME_Timestamp ts;
pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
connection,
@@ -1561,8 +1560,8 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_OK,
GNUNET_JSON_pack_uint64 ("row_id",
row_id),
- GNUNET_JSON_pack_time_abs ("timestamp",
- ts));
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ ts));
}
@@ -2016,8 +2015,8 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
trans = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row_id",
pos->row_id),
- GNUNET_JSON_pack_time_abs ("date",
- pos->date),
+ GNUNET_JSON_pack_timestamp ("date",
+ pos->date),
TALER_JSON_pack_amount ("amount",
&pos->amount),
GNUNET_JSON_pack_string ("credit_account",
@@ -2215,8 +2214,8 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
trans = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row_id",
pos->row_id),
- GNUNET_JSON_pack_time_abs ("date",
- pos->date),
+ GNUNET_JSON_pack_timestamp ("date",
+ pos->date),
TALER_JSON_pack_amount ("amount",
&pos->amount),
GNUNET_JSON_pack_string ("credit_account",
diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c
index 0af3d2662..ab16573a7 100644
--- a/src/bank-lib/taler-exchange-wire-gateway-client.c
+++ b/src/bank-lib/taler-exchange-wire-gateway-client.c
@@ -227,7 +227,7 @@ credit_history_cb (void *cls,
details->credit_account_uri,
TALER_B2S (&details->reserve_pub),
TALER_amount2s (&details->amount),
- GNUNET_STRINGS_absolute_time_to_string (details->execution_date));
+ GNUNET_TIME_timestamp2s (details->execution_date));
return GNUNET_OK;
}
@@ -340,7 +340,7 @@ debit_history_cb (void *cls,
details->credit_account_uri,
TALER_B2S (&details->wtid),
TALER_amount2s (&details->amount),
- GNUNET_STRINGS_absolute_time_to_string (details->execution_date));
+ GNUNET_TIME_timestamp2s (details->execution_date));
return GNUNET_OK;
}
@@ -391,7 +391,7 @@ confirmation_cb (void *cls,
unsigned int response_code,
enum TALER_ErrorCode ec,
uint64_t row_id,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
(void) cls;
eh = NULL;
@@ -408,7 +408,7 @@ confirmation_cb (void *cls,
fprintf (stdout,
"Wire transfer #%llu executed successfully at %s.\n",
(unsigned long long) row_id,
- GNUNET_STRINGS_absolute_time_to_string (timestamp));
+ GNUNET_TIME_timestamp2s (timestamp));
global_ret = 0;
GNUNET_SCHEDULER_shutdown ();
}
@@ -500,7 +500,7 @@ res_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const json_t *json)
{
(void) cls;
diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c
index fbe4c4363..a7d9cca38 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -86,12 +86,12 @@ static struct TALER_DenominationSignature denom_sig;
/**
* Time range when deposits start.
*/
-static struct GNUNET_TIME_Absolute start;
+static struct GNUNET_TIME_Timestamp start;
/**
* Time range when deposits end.
*/
-static struct GNUNET_TIME_Absolute end;
+static struct GNUNET_TIME_Timestamp end;
/**
@@ -171,18 +171,17 @@ make_amountN (unsigned int val,
*
* @return time stamp between start and end
*/
-static struct GNUNET_TIME_Absolute
+static struct GNUNET_TIME_Timestamp
random_time (void)
{
uint64_t delta;
struct GNUNET_TIME_Absolute ret;
- delta = end.abs_value_us - start.abs_value_us;
+ delta = end.abs_time.abs_value_us - start.abs_time.abs_value_us;
delta = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
delta);
- ret.abs_value_us = start.abs_value_us + delta;
- (void) GNUNET_TIME_round_abs (&ret);
- return ret;
+ ret.abs_value_us = start.abs_time.abs_value_us + delta;
+ return GNUNET_TIME_absolute_to_timestamp (ret);
}
@@ -433,11 +432,10 @@ run (void *cls,
/* make sure everything 'ends' before the current time,
so that the aggregator will process everything without
need for time-travel */
- end = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&end);
- start = GNUNET_TIME_absolute_subtract (end,
- GNUNET_TIME_UNIT_MONTHS);
- (void) GNUNET_TIME_round_abs (&start);
+ end = GNUNET_TIME_timestamp_get ();
+ start = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (end.abs_time,
+ GNUNET_TIME_UNIT_MONTHS));
cfg = c;
if (GNUNET_OK !=
TALER_config_get_currency (cfg,
@@ -467,17 +465,19 @@ run (void *cls,
issue.properties.purpose.size = htonl (sizeof (issue.properties));
RANDOMIZE (&issue.properties.master);
issue.properties.start
- = GNUNET_TIME_absolute_hton (start);
+ = GNUNET_TIME_timestamp_hton (start);
issue.properties.expire_withdraw
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (start,
- GNUNET_TIME_UNIT_DAYS));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (start.abs_time,
+ GNUNET_TIME_UNIT_DAYS)));
issue.properties.expire_deposit
- = GNUNET_TIME_absolute_hton (end);
+ = GNUNET_TIME_timestamp_hton (end);
issue.properties.expire_legal
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (end,
- GNUNET_TIME_UNIT_YEARS));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (end.abs_time,
+ GNUNET_TIME_UNIT_YEARS)));
{
struct TALER_DenominationPrivateKey pk;
struct TALER_DenominationPublicKey denom_pub;
@@ -541,14 +541,14 @@ run (void *cls,
struct TALER_Amount wire_fee;
struct TALER_MasterSignatureP master_sig;
unsigned int year;
- struct GNUNET_TIME_Absolute ws;
- struct GNUNET_TIME_Absolute we;
+ struct GNUNET_TIME_Timestamp ws;
+ struct GNUNET_TIME_Timestamp we;
year = GNUNET_TIME_get_current_year ();
for (unsigned int y = year - 1; y<year + 2; y++)
{
- ws = GNUNET_TIME_year_to_time (y - 1);
- we = GNUNET_TIME_year_to_time (y);
+ ws = GNUNET_TIME_absolute_to_timestamp (GNUNET_TIME_year_to_time (y - 1));
+ we = GNUNET_TIME_absolute_to_timestamp (GNUNET_TIME_year_to_time (y));
make_amount (0, 5, &wire_fee);
memset (&master_sig,
0,
diff --git a/src/exchange-tools/Makefile.am b/src/exchange-tools/Makefile.am
index 846ea6132..b233a4b3a 100644
--- a/src/exchange-tools/Makefile.am
+++ b/src/exchange-tools/Makefile.am
@@ -53,8 +53,6 @@ taler_exchange_dbinit_LDADD = \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
-lgnunetutil \
$(XLIB)
-taler_exchange_dbinit_LDFLAGS = \
- $(POSTGRESQL_LDFLAGS)
taler_exchange_dbinit_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \
diff --git a/src/exchange-tools/taler-auditor-offline.c b/src/exchange-tools/taler-auditor-offline.c
index 5ff713a4e..afde705b6 100644
--- a/src/exchange-tools/taler-auditor-offline.c
+++ b/src/exchange-tools/taler-auditor-offline.c
@@ -752,10 +752,10 @@ show_denomkeys (const json_t *denomkeys)
const char *err_name;
unsigned int err_line;
struct TALER_DenominationPublicKey denom_pub;
- struct GNUNET_TIME_Absolute stamp_start;
- struct GNUNET_TIME_Absolute stamp_expire_withdraw;
- struct GNUNET_TIME_Absolute stamp_expire_deposit;
- struct GNUNET_TIME_Absolute stamp_expire_legal;
+ struct GNUNET_TIME_Timestamp stamp_start;
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit;
+ struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@@ -780,14 +780,14 @@ show_denomkeys (const json_t *denomkeys)
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
- GNUNET_JSON_spec_absolute_time ("stamp_start",
- &stamp_start),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &stamp_expire_withdraw),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
- &stamp_expire_deposit),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
- &stamp_expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &stamp_start),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &stamp_expire_withdraw),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &stamp_expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@@ -811,8 +811,9 @@ show_denomkeys (const json_t *denomkeys)
test_shutdown ();
return GNUNET_SYSERR;
}
- duration = GNUNET_TIME_absolute_get_difference (stamp_start,
- stamp_expire_withdraw);
+ duration = GNUNET_TIME_absolute_get_difference (
+ stamp_start.abs_time,
+ stamp_expire_withdraw.abs_time);
TALER_denom_pub_hash (&denom_pub,
&h_denom_pub);
if (GNUNET_OK !=
@@ -851,18 +852,18 @@ show_denomkeys (const json_t *denomkeys)
refresh_fee_s = TALER_amount_to_string (&fee_refresh);
refund_fee_s = TALER_amount_to_string (&fee_refund);
deposit_s = GNUNET_strdup (
- GNUNET_STRINGS_absolute_time_to_string (stamp_expire_deposit));
+ GNUNET_TIME_timestamp2s (stamp_expire_deposit));
legal_s = GNUNET_strdup (
- GNUNET_STRINGS_absolute_time_to_string (stamp_expire_legal));
+ GNUNET_TIME_timestamp2s (stamp_expire_legal));
printf (
"DENOMINATION-KEY %s of value %s starting at %s "
"(used for: %s, deposit until: %s legal end: %s) with fees %s/%s/%s/%s\n",
TALER_B2S (&h_denom_pub),
TALER_amount2s (&coin_value),
- GNUNET_STRINGS_absolute_time_to_string (stamp_start),
- GNUNET_STRINGS_relative_time_to_string (duration,
- GNUNET_NO),
+ GNUNET_TIME_timestamp2s (stamp_start),
+ GNUNET_TIME_relative2s (duration,
+ false),
deposit_s,
legal_s,
withdraw_fee_s,
@@ -1052,10 +1053,10 @@ sign_denomkeys (const json_t *denomkeys)
const char *err_name;
unsigned int err_line;
struct TALER_DenominationPublicKey denom_pub;
- struct GNUNET_TIME_Absolute stamp_start;
- struct GNUNET_TIME_Absolute stamp_expire_withdraw;
- struct GNUNET_TIME_Absolute stamp_expire_deposit;
- struct GNUNET_TIME_Absolute stamp_expire_legal;
+ struct GNUNET_TIME_Timestamp stamp_start;
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit;
+ struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@@ -1080,14 +1081,14 @@ sign_denomkeys (const json_t *denomkeys)
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
- GNUNET_JSON_spec_absolute_time ("stamp_start",
- &stamp_start),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &stamp_expire_withdraw),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
- &stamp_expire_deposit),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
- &stamp_expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &stamp_start),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &stamp_expire_withdraw),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &stamp_expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
index 117e6284e..9255737a9 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -1031,7 +1031,7 @@ upload_auditor_add (const char *exchange_url,
struct TALER_MasterSignatureP master_sig;
const char *auditor_url;
const char *auditor_name;
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
struct TALER_AuditorPublicKeyP auditor_pub;
struct AuditorAddRequest *aar;
const char *err_name;
@@ -1041,8 +1041,8 @@ upload_auditor_add (const char *exchange_url,
&auditor_url),
GNUNET_JSON_spec_string ("auditor_name",
&auditor_name),
- GNUNET_JSON_spec_absolute_time ("validity_start",
- &start_time),
+ GNUNET_JSON_spec_timestamp ("validity_start",
+ &start_time),
GNUNET_JSON_spec_fixed_auto ("auditor_pub",
&auditor_pub),
GNUNET_JSON_spec_fixed_auto ("master_sig",
@@ -1130,15 +1130,15 @@ upload_auditor_del (const char *exchange_url,
{
struct TALER_AuditorPublicKeyP auditor_pub;
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp end_time;
struct AuditorDelRequest *adr;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("auditor_pub",
&auditor_pub),
- GNUNET_JSON_spec_absolute_time ("validity_end",
- &end_time),
+ GNUNET_JSON_spec_timestamp ("validity_end",
+ &end_time),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@@ -1223,15 +1223,15 @@ upload_wire_add (const char *exchange_url,
struct TALER_MasterSignatureP master_sig_add;
struct TALER_MasterSignatureP master_sig_wire;
const char *payto_uri;
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
struct WireAddRequest *war;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("payto_uri",
&payto_uri),
- GNUNET_JSON_spec_absolute_time ("validity_start",
- &start_time),
+ GNUNET_JSON_spec_timestamp ("validity_start",
+ &start_time),
GNUNET_JSON_spec_fixed_auto ("master_sig_add",
&master_sig_add),
GNUNET_JSON_spec_fixed_auto ("master_sig_wire",
@@ -1333,15 +1333,15 @@ upload_wire_del (const char *exchange_url,
{
struct TALER_MasterSignatureP master_sig;
const char *payto_uri;
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp end_time;
struct WireDelRequest *wdr;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("payto_uri",
&payto_uri),
- GNUNET_JSON_spec_absolute_time ("validity_end",
- &end_time),
+ GNUNET_JSON_spec_timestamp ("validity_end",
+ &end_time),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@@ -1431,8 +1431,8 @@ upload_wire_fee (const char *exchange_url,
unsigned int err_line;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
- struct GNUNET_TIME_Absolute start_time;
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp start_time;
+ struct GNUNET_TIME_Timestamp end_time;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("wire_method",
&wire_method),
@@ -1442,10 +1442,10 @@ upload_wire_fee (const char *exchange_url,
TALER_JSON_spec_amount ("closing_fee",
currency,
&closing_fee),
- GNUNET_JSON_spec_absolute_time ("start_time",
- &start_time),
- GNUNET_JSON_spec_absolute_time ("end_time",
- &end_time),
+ GNUNET_JSON_spec_timestamp ("start_time",
+ &start_time),
+ GNUNET_JSON_spec_timestamp ("end_time",
+ &end_time),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@@ -1926,7 +1926,7 @@ do_add_auditor (char *const *args)
{
struct TALER_MasterSignatureP master_sig;
struct TALER_AuditorPublicKeyP auditor_pub;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@@ -1965,8 +1965,7 @@ do_add_auditor (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
TALER_exchange_offline_auditor_add_sign (&auditor_pub,
args[1],
now,
@@ -1978,8 +1977,8 @@ do_add_auditor (char *const *args)
args[1]),
GNUNET_JSON_pack_string ("auditor_name",
args[2]),
- GNUNET_JSON_pack_time_abs ("validity_start",
- now),
+ GNUNET_JSON_pack_timestamp ("validity_start",
+ now),
GNUNET_JSON_pack_data_auto ("auditor_pub",
&auditor_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
@@ -1999,7 +1998,7 @@ do_del_auditor (char *const *args)
{
struct TALER_MasterSignatureP master_sig;
struct TALER_AuditorPublicKeyP auditor_pub;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@@ -2025,9 +2024,7 @@ do_del_auditor (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
-
+ now = GNUNET_TIME_timestamp_get ();
TALER_exchange_offline_auditor_del_sign (&auditor_pub,
now,
&master_priv,
@@ -2036,8 +2033,8 @@ do_del_auditor (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("auditor_pub",
&auditor_pub),
- GNUNET_JSON_pack_time_abs ("validity_end",
- now),
+ GNUNET_JSON_pack_timestamp ("validity_end",
+ now),
GNUNET_JSON_pack_data_auto ("master_sig",
&master_sig)));
next (args + 1);
@@ -2055,7 +2052,7 @@ do_add_wire (char *const *args)
{
struct TALER_MasterSignatureP master_sig_add;
struct TALER_MasterSignatureP master_sig_wire;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@@ -2076,9 +2073,7 @@ do_add_wire (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
-
+ now = GNUNET_TIME_timestamp_get ();
{
char *wire_method;
@@ -2105,8 +2100,8 @@ do_add_wire (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("payto_uri",
args[0]),
- GNUNET_JSON_pack_time_abs ("validity_start",
- now),
+ GNUNET_JSON_pack_timestamp ("validity_start",
+ now),
GNUNET_JSON_pack_data_auto ("master_sig_add",
&master_sig_add),
GNUNET_JSON_pack_data_auto ("master_sig_wire",
@@ -2125,7 +2120,7 @@ static void
do_del_wire (char *const *args)
{
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@@ -2146,9 +2141,7 @@ do_del_wire (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
-
+ now = GNUNET_TIME_timestamp_get ();
TALER_exchange_offline_wire_del_sign (args[0],
now,
&master_priv,
@@ -2157,8 +2150,8 @@ do_del_wire (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("payto_uri",
args[0]),
- GNUNET_JSON_pack_time_abs ("validity_end",
- now),
+ GNUNET_JSON_pack_timestamp ("validity_end",
+ now),
GNUNET_JSON_pack_data_auto ("master_sig",
&master_sig)));
next (args + 1);
@@ -2180,8 +2173,8 @@ do_set_wire_fee (char *const *args)
unsigned int year;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
- struct GNUNET_TIME_Absolute start_time;
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp start_time;
+ struct GNUNET_TIME_Timestamp end_time;
if (NULL != in)
{
@@ -2220,8 +2213,10 @@ do_set_wire_fee (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
- start_time = GNUNET_TIME_year_to_time (year);
- end_time = GNUNET_TIME_year_to_time (year + 1);
+ start_time = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_year_to_time (year));
+ end_time = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_year_to_time (year + 1));
TALER_exchange_offline_wire_fee_sign (args[1],
start_time,
@@ -2234,10 +2229,10 @@ do_set_wire_fee (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("wire_method",
args[1]),
- GNUNET_JSON_pack_time_abs ("start_time",
- start_time),
- GNUNET_JSON_pack_time_abs ("end_time",
- end_time),
+ GNUNET_JSON_pack_timestamp ("start_time",
+ start_time),
+ GNUNET_JSON_pack_timestamp ("end_time",
+ end_time),
TALER_JSON_pack_amount ("wire_fee",
&wire_fee),
TALER_JSON_pack_amount ("closing_fee",
@@ -2504,17 +2499,17 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_SecurityModuleSignatureP secm_sig;
- struct GNUNET_TIME_Absolute start_time;
- struct GNUNET_TIME_Absolute sign_end;
- struct GNUNET_TIME_Absolute legal_end;
+ struct GNUNET_TIME_Timestamp start_time;
+ struct GNUNET_TIME_Timestamp sign_end;
+ struct GNUNET_TIME_Timestamp legal_end;
struct GNUNET_TIME_Relative duration;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_absolute_time ("stamp_start",
- &start_time),
- GNUNET_JSON_spec_absolute_time ("stamp_expire",
- &sign_end),
- GNUNET_JSON_spec_absolute_time ("stamp_end",
- &legal_end),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &start_time),
+ GNUNET_JSON_spec_timestamp ("stamp_expire",
+ &sign_end),
+ GNUNET_JSON_spec_timestamp ("stamp_end",
+ &legal_end),
GNUNET_JSON_spec_fixed_auto ("key",
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
@@ -2540,8 +2535,8 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
test_shutdown ();
return GNUNET_SYSERR;
}
- duration = GNUNET_TIME_absolute_get_difference (start_time,
- sign_end);
+ duration = GNUNET_TIME_absolute_get_difference (start_time.abs_time,
+ sign_end.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (&exchange_pub,
start_time,
@@ -2560,12 +2555,12 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
char *legal_end_s;
legal_end_s = GNUNET_strdup (
- GNUNET_STRINGS_absolute_time_to_string (legal_end));
+ GNUNET_TIME_timestamp2s (legal_end));
printf ("EXCHANGE-KEY %s starting at %s (used for: %s, legal end: %s)\n",
TALER_B2S (&exchange_pub),
- GNUNET_STRINGS_absolute_time_to_string (start_time),
- GNUNET_STRINGS_relative_time_to_string (duration,
- GNUNET_NO),
+ GNUNET_TIME_timestamp2s (start_time),
+ GNUNET_TIME_relative2s (duration,
+ false),
legal_end_s);
GNUNET_free (legal_end_s);
}
@@ -2593,10 +2588,10 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
const char *section_name;
struct TALER_DenominationPublicKey denom_pub;
- struct GNUNET_TIME_Absolute stamp_start;
- struct GNUNET_TIME_Absolute stamp_expire_withdraw;
- struct GNUNET_TIME_Absolute stamp_expire_deposit;
- struct GNUNET_TIME_Absolute stamp_expire_legal;
+ struct GNUNET_TIME_Timestamp stamp_start;
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit;
+ struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@@ -2623,14 +2618,14 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
- GNUNET_JSON_spec_absolute_time ("stamp_start",
- &stamp_start),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &stamp_expire_withdraw),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
- &stamp_expire_deposit),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
- &stamp_expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &stamp_start),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &stamp_expire_withdraw),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &stamp_expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_sig",
&secm_sig),
GNUNET_JSON_spec_end ()
@@ -2658,8 +2653,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
test_shutdown ();
return GNUNET_SYSERR;
}
- duration = GNUNET_TIME_absolute_get_difference (stamp_start,
- stamp_expire_withdraw);
+ duration = GNUNET_TIME_absolute_get_difference (
+ stamp_start.abs_time,
+ stamp_expire_withdraw.abs_time);
TALER_denom_pub_hash (&denom_pub,
&h_denom_pub);
switch (denom_pub.cipher)
@@ -2706,9 +2702,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
refresh_fee_s = TALER_amount_to_string (&fee_refresh);
refund_fee_s = TALER_amount_to_string (&fee_refund);
deposit_s = GNUNET_strdup (
- GNUNET_STRINGS_absolute_time_to_string (stamp_expire_deposit));
+ GNUNET_TIME_timestamp2s (stamp_expire_deposit));
legal_s = GNUNET_strdup (
- GNUNET_STRINGS_absolute_time_to_string (stamp_expire_legal));
+ GNUNET_TIME_timestamp2s (stamp_expire_legal));
printf (
"DENOMINATION-KEY(%s) %s of value %s starting at %s "
@@ -2716,9 +2712,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
section_name,
TALER_B2S (&h_denom_pub),
TALER_amount2s (&coin_value),
- GNUNET_STRINGS_absolute_time_to_string (stamp_start),
- GNUNET_STRINGS_relative_time_to_string (duration,
- GNUNET_NO),
+ GNUNET_TIME_timestamp2s (stamp_start),
+ GNUNET_TIME_relative2s (duration,
+ false),
deposit_s,
legal_s,
withdraw_fee_s,
@@ -2929,17 +2925,17 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_SecurityModuleSignatureP secm_sig;
- struct GNUNET_TIME_Absolute start_time;
- struct GNUNET_TIME_Absolute sign_end;
- struct GNUNET_TIME_Absolute legal_end;
+ struct GNUNET_TIME_Timestamp start_time;
+ struct GNUNET_TIME_Timestamp sign_end;
+ struct GNUNET_TIME_Timestamp legal_end;
struct GNUNET_TIME_Relative duration;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_absolute_time ("stamp_start",
- &start_time),
- GNUNET_JSON_spec_absolute_time ("stamp_expire",
- &sign_end),
- GNUNET_JSON_spec_absolute_time ("stamp_end",
- &legal_end),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &start_time),
+ GNUNET_JSON_spec_timestamp ("stamp_expire",
+ &sign_end),
+ GNUNET_JSON_spec_timestamp ("stamp_end",
+ &legal_end),
GNUNET_JSON_spec_fixed_auto ("key",
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
@@ -2966,8 +2962,8 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
return GNUNET_SYSERR;
}
- duration = GNUNET_TIME_absolute_get_difference (start_time,
- sign_end);
+ duration = GNUNET_TIME_absolute_get_difference (start_time.abs_time,
+ sign_end.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (&exchange_pub,
start_time,
@@ -3028,10 +3024,10 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
const char *section_name;
struct TALER_DenominationPublicKey denom_pub;
- struct GNUNET_TIME_Absolute stamp_start;
- struct GNUNET_TIME_Absolute stamp_expire_withdraw;
- struct GNUNET_TIME_Absolute stamp_expire_deposit;
- struct GNUNET_TIME_Absolute stamp_expire_legal;
+ struct GNUNET_TIME_Timestamp stamp_start;
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit;
+ struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@@ -3058,14 +3054,14 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
- GNUNET_JSON_spec_absolute_time ("stamp_start",
- &stamp_start),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &stamp_expire_withdraw),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
- &stamp_expire_deposit),
- GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
- &stamp_expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &stamp_start),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &stamp_expire_withdraw),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &stamp_expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_sig",
&secm_sig),
GNUNET_JSON_spec_end ()
@@ -3092,8 +3088,9 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
test_shutdown ();
return GNUNET_SYSERR;
}
- duration = GNUNET_TIME_absolute_get_difference (stamp_start,
- stamp_expire_withdraw);
+ duration = GNUNET_TIME_absolute_get_difference (
+ stamp_start.abs_time,
+ stamp_expire_withdraw.abs_time);
// FIXME-Oec: setup age mask here?
TALER_denom_pub_hash (&denom_pub,
&h_denom_pub);
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 73bbcc594..32b069f90 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -71,7 +71,7 @@ struct AggregationUnit
* The current time (which triggered the aggregation and
* defines the wire fee).
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Wire details of the merchant.
@@ -116,7 +116,7 @@ struct Shard
/**
* When did we start processing the shard?
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* Starting row of the shard.
@@ -445,12 +445,11 @@ deposit_cb (void *cls,
}
/* make sure we have current fees */
- au->execution_time = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&au->execution_time);
+ au->execution_time = GNUNET_TIME_timestamp_get ();
{
struct TALER_Amount closing_fee;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_MasterSignatureP master_sig;
enum GNUNET_DB_QueryStatus qs;
@@ -467,7 +466,7 @@ deposit_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not get wire fees for %s at %s. Aborting run.\n",
au->wa->method,
- GNUNET_STRINGS_absolute_time_to_string (au->execution_time));
+ GNUNET_TIME_timestamp2s (au->execution_time));
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
@@ -738,7 +737,7 @@ run_aggregation (void *cls)
{
uint64_t counter = s->work_counter;
struct GNUNET_TIME_Relative duration
- = GNUNET_TIME_absolute_get_duration (s->start_time);
+ = GNUNET_TIME_absolute_get_duration (s->start_time.abs_time);
cleanup_au (&au_active);
db_plugin->rollback (db_plugin->cls);
@@ -746,8 +745,8 @@ run_aggregation (void *cls)
"Completed shard [%u,%u] after %s with %llu deposits\n",
(unsigned int) s->shard_start,
(unsigned int) s->shard_end,
- GNUNET_STRINGS_relative_time_to_string (duration,
- GNUNET_YES),
+ GNUNET_TIME_relative2s (duration,
+ true),
(unsigned long long) counter);
release_shard (s);
if ( (GNUNET_YES == test_mode) &&
@@ -1009,7 +1008,7 @@ run_shard (void *cls)
return;
}
s = GNUNET_new (struct Shard);
- s->start_time = GNUNET_TIME_absolute_get ();
+ s->start_time = GNUNET_TIME_timestamp_get ();
qs = db_plugin->begin_revolving_shard (db_plugin->cls,
"aggregator",
shard_size,
diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c
index 3f30db7ba..3847e05b2 100644
--- a/src/exchange/taler-exchange-closer.c
+++ b/src/exchange/taler-exchange-closer.c
@@ -211,9 +211,9 @@ expired_reserve_cb (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *left,
const char *account_payto_uri,
- struct GNUNET_TIME_Absolute expiration_date)
+ struct GNUNET_TIME_Timestamp expiration_date)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct TALER_WireTransferIdentifierRawP wtid;
struct TALER_Amount amount_without_fee;
struct TALER_Amount closing_fee;
@@ -226,9 +226,8 @@ expired_reserve_cb (void *cls,
fetch this: */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Processing reserve closure at %s\n",
- GNUNET_STRINGS_absolute_time_to_string (expiration_date));
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ GNUNET_TIME_timestamp2s (expiration_date));
+ now = GNUNET_TIME_timestamp_get ();
/* lookup account we should use */
wa = TALER_EXCHANGEDB_find_account_by_payto_uri (account_payto_uri);
@@ -246,8 +245,8 @@ expired_reserve_cb (void *cls,
(we may be lagging behind!) */
{
struct TALER_Amount wire_fee;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_MasterSignatureP master_sig;
enum GNUNET_DB_QueryStatus qs;
@@ -264,7 +263,7 @@ expired_reserve_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not get wire fees for %s at %s. Aborting run.\n",
wa->method,
- GNUNET_STRINGS_absolute_time_to_string (expiration_date));
+ GNUNET_TIME_timestamp2s (expiration_date));
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
@@ -382,7 +381,7 @@ static void
run_reserve_closures (void *cls)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cls;
task = NULL;
@@ -406,11 +405,10 @@ run_reserve_closures (void *cls)
GNUNET_SCHEDULER_shutdown ();
return;
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for reserves to close by date %s\n",
- GNUNET_STRINGS_absolute_time_to_string (now));
+ GNUNET_TIME_timestamp2s (now));
qs = db_plugin->get_expired_reserves (db_plugin->cls,
now,
&expired_reserve_cb,
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 43acad44b..11094d11c 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -60,9 +60,9 @@ reply_deposit_success (struct MHD_Connection *connection,
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute wire_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp wire_deadline,
const struct TALER_MerchantPublicKeyP *merchant,
const struct TALER_Amount *amount_without_fee)
{
@@ -73,9 +73,9 @@ reply_deposit_success (struct MHD_Connection *connection,
.purpose.size = htonl (sizeof (dc)),
.h_contract_terms = *h_contract_terms,
.h_wire = *h_wire,
- .exchange_timestamp = GNUNET_TIME_absolute_hton (exchange_timestamp),
- .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
- .wire_deadline = GNUNET_TIME_absolute_hton (wire_deadline),
+ .exchange_timestamp = GNUNET_TIME_timestamp_hton (exchange_timestamp),
+ .refund_deadline = GNUNET_TIME_timestamp_hton (refund_deadline),
+ .wire_deadline = GNUNET_TIME_timestamp_hton (wire_deadline),
.coin_pub = *coin_pub,
.merchant_pub = *merchant
};
@@ -97,8 +97,8 @@ reply_deposit_success (struct MHD_Connection *connection,
return TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_OK,
- GNUNET_JSON_pack_time_abs ("exchange_timestamp",
- exchange_timestamp),
+ GNUNET_JSON_pack_timestamp ("exchange_timestamp",
+ exchange_timestamp),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
@@ -119,7 +119,7 @@ struct DepositContext
/**
* Our timestamp (when we received the request).
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* Calculated hash over the wire details.
@@ -281,13 +281,13 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&deposit.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&deposit.csig),
- TALER_JSON_spec_absolute_time ("timestamp",
- &deposit.timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &deposit.timestamp),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &deposit.refund_deadline)),
- TALER_JSON_spec_absolute_time ("wire_transfer_deadline",
- &deposit.wire_deadline),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &deposit.refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
+ &deposit.wire_deadline),
GNUNET_JSON_spec_end ()
};
@@ -332,7 +332,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
}
}
deposit.receiver_wire_account = (char *) dc.payto_uri;
- if (deposit.refund_deadline.abs_value_us > deposit.wire_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (deposit.refund_deadline,
+ >,
+ deposit.wire_deadline))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
@@ -347,8 +349,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
dc.deposit = &deposit;
/* new deposit */
- dc.exchange_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&dc.exchange_timestamp);
+ dc.exchange_timestamp = GNUNET_TIME_timestamp_get ();
/* check denomination exists and is valid */
{
struct TEH_DenominationKey *dk;
@@ -362,13 +363,12 @@ TEH_handler_deposit (struct MHD_Connection *connection,
GNUNET_JSON_parse_free (spec);
return mret;
}
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{
/* This denomination is past the expiration time for deposits */
- 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 ();
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -377,13 +377,12 @@ TEH_handler_deposit (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"DEPOSIT");
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
/* This denomination is not yet valid */
- 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 ();
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -394,10 +393,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
}
if (dk->recoup_possible)
{
- 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 ();
/* This denomination has been revoked */
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c
index 3db177015..9a33f2b71 100644
--- a/src/exchange/taler-exchange-httpd_deposits_get.c
+++ b/src/exchange/taler-exchange-httpd_deposits_get.c
@@ -52,7 +52,7 @@ reply_deposit_details (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_contribution,
const struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute exec_time)
+ struct GNUNET_TIME_Timestamp exec_time)
{
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
@@ -63,7 +63,7 @@ reply_deposit_details (struct MHD_Connection *connection,
.h_contract_terms = *h_contract_terms,
.wtid = *wtid,
.coin_pub = *coin_pub,
- .execution_time = GNUNET_TIME_absolute_hton (exec_time)
+ .execution_time = GNUNET_TIME_timestamp_hton (exec_time)
};
enum TALER_ErrorCode ec;
@@ -83,8 +83,8 @@ reply_deposit_details (struct MHD_Connection *connection,
MHD_HTTP_OK,
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
- GNUNET_JSON_pack_time_abs ("execution_time",
- exec_time),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ exec_time),
TALER_JSON_pack_amount ("coin_contribution",
coin_contribution),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -128,7 +128,7 @@ struct DepositWtidContext
/**
* Set by #handle_wtid data to the wire transfer execution time.
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Set by #handle_wtid to the coin contribution to the transaction
@@ -264,8 +264,8 @@ handle_track_transaction_request (
ctx.kyc.payment_target_uuid),
GNUNET_JSON_pack_bool ("kyc_ok",
ctx.kyc.ok),
- GNUNET_JSON_pack_time_abs ("execution_time",
- ctx.execution_time));
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ ctx.execution_time));
return reply_deposit_details (connection,
&tps->h_contract_terms,
&tps->h_wire,
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index 29d964c6b..231a2715b 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -57,7 +57,7 @@
* #TALER_PROTOCOL_CURRENT and #TALER_PROTOCOL_AGE in
* exchange_api_handle.c!
*/
-#define EXCHANGE_PROTOCOL_VERSION "10:0:0"
+#define EXCHANGE_PROTOCOL_VERSION "11:0:0"
/**
@@ -69,7 +69,7 @@ struct HelperDenomination
/**
* When will the helper start to use this key for signing?
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* For how long will the helper allow signing? 0 if
@@ -150,7 +150,7 @@ struct HelperSignkey
/**
* When will the helper start to use this key for signing?
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* For how long will the helper allow signing? 0 if
@@ -234,7 +234,7 @@ struct KeysResponseData
* The client's request must include this date or a higher one
* for this response to be applicable.
*/
- struct GNUNET_TIME_Absolute cherry_pick_date;
+ struct GNUNET_TIME_Timestamp cherry_pick_date;
};
@@ -319,7 +319,7 @@ struct TEH_KeyStateHandle
/**
* When did we initiate the key reloading?
*/
- struct GNUNET_TIME_Absolute reload_time;
+ struct GNUNET_TIME_Timestamp reload_time;
/**
* What is the period at which we rotate keys
@@ -331,7 +331,7 @@ struct TEH_KeyStateHandle
* When does our online signing key expire and we
* thus need to re-generate this response?
*/
- struct GNUNET_TIME_Absolute signature_expires;
+ struct GNUNET_TIME_Timestamp signature_expires;
/**
* True if #finish_keys_response() was not yet run and this key state
@@ -808,7 +808,7 @@ static void
helper_rsa_cb (
void *cls,
const char *section_name,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_RsaPubHashP *h_rsa,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -885,7 +885,7 @@ helper_rsa_cb (
static void
helper_esign_cb (
void *cls,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_SecurityModulePublicKeyP *sm_pub,
@@ -1173,10 +1173,10 @@ denomination_info_cb (
struct TEH_DenominationKey *dk;
GNUNET_assert (TALER_DENOMINATION_INVALID != denom_pub->cipher);
- if ( (0 == meta->start.abs_value_us) ||
- (0 == meta->expire_withdraw.abs_value_us) ||
- (0 == meta->expire_deposit.abs_value_us) ||
- (0 == meta->expire_legal.abs_value_us) )
+ if (GNUNET_TIME_absolute_is_zero (meta->start.abs_time) ||
+ GNUNET_TIME_absolute_is_zero (meta->expire_withdraw.abs_time) ||
+ GNUNET_TIME_absolute_is_zero (meta->expire_deposit.abs_time) ||
+ GNUNET_TIME_absolute_is_zero (meta->expire_legal.abs_time) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Database contains invalid denomination key %s\n",
@@ -1400,25 +1400,25 @@ add_sign_key_cb (void *cls,
struct SigningKey *sk = value;
(void) pid;
- if (GNUNET_TIME_absolute_is_future (sk->meta.expire_sign))
+ if (GNUNET_TIME_absolute_is_future (sk->meta.expire_sign.abs_time))
{
ctx->min_sk_frequency =
GNUNET_TIME_relative_min (ctx->min_sk_frequency,
GNUNET_TIME_absolute_get_difference (
- sk->meta.start,
- sk->meta.expire_sign));
+ sk->meta.start.abs_time,
+ sk->meta.expire_sign.abs_time));
}
GNUNET_assert (
0 ==
json_array_append_new (
ctx->signkeys,
GNUNET_JSON_PACK (
- GNUNET_JSON_pack_time_abs ("stamp_start",
- sk->meta.start),
- GNUNET_JSON_pack_time_abs ("stamp_expire",
- sk->meta.expire_sign),
- GNUNET_JSON_pack_time_abs ("stamp_end",
- sk->meta.expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ sk->meta.start),
+ GNUNET_JSON_pack_timestamp ("stamp_expire",
+ sk->meta.expire_sign),
+ GNUNET_JSON_pack_timestamp ("stamp_end",
+ sk->meta.expire_legal),
GNUNET_JSON_pack_data_auto ("master_sig",
&sk->master_sig),
GNUNET_JSON_pack_data_auto ("key",
@@ -1481,17 +1481,17 @@ add_denom_key_cb (void *cls,
}
else
{
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
dkc->min_dk_frequency =
GNUNET_TIME_relative_min (dkc->min_dk_frequency,
GNUNET_TIME_absolute_get_difference (
- dk->meta.start,
- dk->meta.expire_withdraw));
+ dk->meta.start.abs_time,
+ dk->meta.expire_withdraw.abs_time));
}
(void) GNUNET_CONTAINER_heap_insert (dkc->heap,
dk,
- dk->meta.start.abs_value_us);
+ dk->meta.start.abs_time.abs_value_us);
}
return GNUNET_OK;
}
@@ -1567,7 +1567,7 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
"application/json"));
- get_date_string (ksh->reload_time,
+ get_date_string (ksh->reload_time.abs_time,
dat);
GNUNET_break (MHD_YES ==
MHD_add_response_header (response,
@@ -1576,12 +1576,14 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
if (! GNUNET_TIME_relative_is_zero (ksh->rekey_frequency))
{
struct GNUNET_TIME_Relative r;
- struct GNUNET_TIME_Absolute m;
+ struct GNUNET_TIME_Absolute a;
+ struct GNUNET_TIME_Timestamp m;
r = GNUNET_TIME_relative_min (TEH_max_keys_caching,
ksh->rekey_frequency);
- m = GNUNET_TIME_relative_to_absolute (r);
- get_date_string (m,
+ a = GNUNET_TIME_relative_to_absolute (r);
+ m = GNUNET_TIME_absolute_to_timestamp (a);
+ get_date_string (m.abs_time,
dat);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Setting /keys 'Expires' header to '%s'\n",
@@ -1591,8 +1593,8 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
MHD_HTTP_HEADER_EXPIRES,
dat));
ksh->signature_expires
- = GNUNET_TIME_absolute_min (m,
- ksh->signature_expires);
+ = GNUNET_TIME_timestamp_min (m,
+ ksh->signature_expires);
}
return GNUNET_OK;
}
@@ -1613,7 +1615,7 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
static enum GNUNET_GenericReturnValue
create_krd (struct TEH_KeyStateHandle *ksh,
const struct GNUNET_HashCode *denom_keys_hash,
- struct GNUNET_TIME_Absolute last_cpd,
+ struct GNUNET_TIME_Timestamp last_cpd,
json_t *signkeys,
json_t *recoup,
json_t *denoms)
@@ -1623,7 +1625,7 @@ create_krd (struct TEH_KeyStateHandle *ksh,
struct TALER_ExchangeSignatureP exchange_sig;
json_t *keys;
- GNUNET_assert (0 != last_cpd.abs_value_us);
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (last_cpd.abs_time));
GNUNET_assert (NULL != signkeys);
GNUNET_assert (NULL != recoup);
GNUNET_assert (NULL != denoms);
@@ -1631,13 +1633,13 @@ create_krd (struct TEH_KeyStateHandle *ksh,
GNUNET_assert (NULL != TEH_currency);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Creating /keys at cherry pick date %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_cpd));
+ GNUNET_TIME_timestamp2s (last_cpd));
/* Sign hash over denomination keys */
{
struct TALER_ExchangeKeySetPS ks = {
.purpose.size = htonl (sizeof (ks)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET),
- .list_issue_date = GNUNET_TIME_absolute_hton (last_cpd),
+ .list_issue_date = GNUNET_TIME_timestamp_hton (last_cpd),
.hc = *denom_keys_hash
};
enum TALER_ErrorCode ec;
@@ -1660,8 +1662,8 @@ create_krd (struct TEH_KeyStateHandle *ksh,
sk = GNUNET_CONTAINER_multipeermap_get (
ksh->signkey_map,
(const struct GNUNET_PeerIdentity *) &exchange_pub);
- ksh->signature_expires = GNUNET_TIME_absolute_min (sk->meta.expire_sign,
- ksh->signature_expires);
+ ksh->signature_expires = GNUNET_TIME_timestamp_min (sk->meta.expire_sign,
+ ksh->signature_expires);
}
keys = GNUNET_JSON_PACK (
@@ -1681,8 +1683,8 @@ create_krd (struct TEH_KeyStateHandle *ksh,
denoms),
GNUNET_JSON_pack_array_incref ("auditors",
ksh->auditors),
- GNUNET_JSON_pack_time_abs ("list_issue_date",
- last_cpd),
+ GNUNET_JSON_pack_timestamp ("list_issue_date",
+ last_cpd),
GNUNET_JSON_pack_data_auto ("eddsa_pub",
&exchange_pub),
GNUNET_JSON_pack_data_auto ("eddsa_sig",
@@ -1768,7 +1770,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
json_t *recoup;
struct SignKeyCtx sctx;
json_t *denoms;
- struct GNUNET_TIME_Absolute last_cpd;
+ struct GNUNET_TIME_Timestamp last_cpd;
struct GNUNET_CONTAINER_Heap *heap;
struct GNUNET_HashContext *hash_context;
@@ -1797,7 +1799,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
}
denoms = json_array ();
GNUNET_assert (NULL != denoms);
- last_cpd = GNUNET_TIME_UNIT_ZERO_ABS;
+ last_cpd = GNUNET_TIME_UNIT_ZERO_TS;
hash_context = GNUNET_CRYPTO_hash_context_start ();
{
struct TEH_DenominationKey *dk;
@@ -1805,8 +1807,10 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
/* heap = min heap, sorted by start time */
while (NULL != (dk = GNUNET_CONTAINER_heap_remove_root (heap)))
{
- if ( (last_cpd.abs_value_us != dk->meta.start.abs_value_us) &&
- (0 != last_cpd.abs_value_us) )
+ if (GNUNET_TIME_timestamp_cmp (last_cpd,
+ !=,
+ dk->meta.start) &&
+ (! GNUNET_TIME_absolute_is_zero (last_cpd.abs_time)) )
{
struct GNUNET_HashCode hc;
@@ -1823,7 +1827,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to generate key response data for %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_cpd));
+ GNUNET_TIME_timestamp2s (last_cpd));
GNUNET_CRYPTO_hash_context_abort (hash_context);
/* drain heap before destroying it */
while (NULL != (dk = GNUNET_CONTAINER_heap_remove_root (heap)))
@@ -1846,14 +1850,14 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
&dk->master_sig),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- dk->meta.start),
- GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
- dk->meta.expire_withdraw),
- GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
- dk->meta.expire_deposit),
- GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
- dk->meta.expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ dk->meta.start),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
+ dk->meta.expire_withdraw),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
+ dk->meta.expire_deposit),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
+ dk->meta.expire_legal),
TALER_JSON_pack_denom_pub ("denom_pub",
&dk->denom_pub),
TALER_JSON_pack_amount ("value",
@@ -1869,7 +1873,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
}
}
GNUNET_CONTAINER_heap_destroy (heap);
- if (0 != last_cpd.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (last_cpd.abs_time))
{
struct GNUNET_HashCode hc;
@@ -1885,7 +1889,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to generate key response data for %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_cpd));
+ GNUNET_TIME_timestamp2s (last_cpd));
json_decref (denoms);
json_decref (sctx.signkeys);
json_decref (recoup);
@@ -1922,9 +1926,8 @@ build_key_state (struct HelperState *hs,
enum GNUNET_DB_QueryStatus qs;
ksh = GNUNET_new (struct TEH_KeyStateHandle);
- ksh->signature_expires = GNUNET_TIME_UNIT_FOREVER_ABS;
- ksh->reload_time = GNUNET_TIME_absolute_get ();
- GNUNET_TIME_round_abs (&ksh->reload_time);
+ ksh->signature_expires = GNUNET_TIME_UNIT_FOREVER_TS;
+ ksh->reload_time = GNUNET_TIME_timestamp_get ();
/* We must use the key_generation from when we STARTED the process! */
ksh->key_generation = key_generation;
if (NULL == hs)
@@ -2054,7 +2057,7 @@ get_key_state (bool management_only)
return ksh;
}
if ( (old_ksh->key_generation < key_generation) ||
- (GNUNET_TIME_absolute_is_past (old_ksh->signature_expires)) )
+ (GNUNET_TIME_absolute_is_past (old_ksh->signature_expires.abs_time)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Rebuilding /keys, generation upgrade from %llu to %llu\n",
@@ -2298,7 +2301,7 @@ TEH_keys_exchange_revoke (const struct TALER_ExchangePublicKeyP *exchange_pub)
* Comparator used for a binary search by cherry_pick_date for @a key in the
* `struct KeysResponseData` array. See libc's qsort() and bsearch() functions.
*
- * @param key pointer to a `struct GNUNET_TIME_Absolute`
+ * @param key pointer to a `struct GNUNET_TIME_Timestamp`
* @param value pointer to a `struct KeysResponseData` array entry
* @return 0 if time matches, -1 if key is smaller, 1 if key is larger
*/
@@ -2306,12 +2309,16 @@ static int
krd_search_comparator (const void *key,
const void *value)
{
- const struct GNUNET_TIME_Absolute *kd = key;
+ const struct GNUNET_TIME_Timestamp *kd = key;
const struct KeysResponseData *krd = value;
- if (kd->abs_value_us > krd->cherry_pick_date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*kd,
+ >,
+ krd->cherry_pick_date))
return -1;
- if (kd->abs_value_us < krd->cherry_pick_date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*kd,
+ <,
+ krd->cherry_pick_date))
return 1;
return 0;
}
@@ -2321,7 +2328,7 @@ MHD_RESULT
TEH_keys_get_handler (struct TEH_RequestContext *rc,
const char *const args[])
{
- struct GNUNET_TIME_Absolute last_issue_date;
+ struct GNUNET_TIME_Timestamp last_issue_date;
(void) args;
{
@@ -2349,11 +2356,11 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc,
be a problem, as giving back 'older' data than what the client asks for
(given that the client asks for data in the distant future) is not
problematic */
- last_issue_date = GNUNET_TIME_absolute_from_s (cherrypickn);
+ last_issue_date = GNUNET_TIME_timestamp_from_s (cherrypickn);
}
else
{
- last_issue_date.abs_value_us = 0LLU;
+ last_issue_date = GNUNET_TIME_UNIT_ZERO_TS;
}
}
@@ -2385,16 +2392,16 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc,
&krd_search_comparator);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Filtering /keys by cherry pick date %s found entry %u/%u\n",
- GNUNET_STRINGS_absolute_time_to_string (last_issue_date),
+ GNUNET_TIME_timestamp2s (last_issue_date),
(unsigned int) (krd - ksh->krd_array),
ksh->krd_array_length);
if ( (NULL == krd) &&
(ksh->krd_array_length > 0) )
{
- if (0 != last_issue_date.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (last_issue_date.abs_time))
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Client provided invalid cherry picking timestamp %s, returning full response\n",
- GNUNET_STRINGS_absolute_time_to_string (last_issue_date));
+ GNUNET_TIME_timestamp2s (last_issue_date));
krd = &ksh->krd_array[ksh->krd_array_length - 1];
}
if (NULL == krd)
@@ -2430,7 +2437,7 @@ load_extension_data (const char *section_name,
struct GNUNET_TIME_Relative deposit_duration;
struct GNUNET_TIME_Relative legal_duration;
- GNUNET_assert (0 != meta->start.abs_value_us); /* caller bug */
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (meta->start.abs_time)); /* caller bug */
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (TEH_cfg,
section_name,
@@ -2453,14 +2460,13 @@ load_extension_data (const char *section_name,
"DURATION_LEGAL");
return GNUNET_SYSERR;
}
- /* NOTE: this is a change from the 0.8 semantics of the configuration:
- before duration_spend was relative to 'start', not to 'expire_withdraw'.
- But doing it this way avoids the error case where previously
- duration_spend < duration_withdraw was not allowed. */
- meta->expire_deposit = GNUNET_TIME_absolute_add (meta->expire_withdraw,
- deposit_duration);
- meta->expire_legal = GNUNET_TIME_absolute_add (meta->expire_deposit,
- legal_duration);
+ meta->expire_deposit
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->expire_withdraw.abs_time,
+ deposit_duration));
+ meta->expire_legal = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->expire_deposit.abs_time,
+ legal_duration));
if (GNUNET_OK !=
TALER_config_get_amount (TEH_cfg,
section_name,
@@ -2569,8 +2575,9 @@ TEH_keys_load_fees (const struct TALER_DenominationHash *h_denom_pub,
return GNUNET_NO;
}
meta->start = hd->start_time;
- meta->expire_withdraw = GNUNET_TIME_absolute_add (meta->start,
- hd->validity_duration);
+ meta->expire_withdraw = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->start.abs_time,
+ hd->validity_duration));
ok = load_extension_data (hd->section_name,
meta);
if (GNUNET_OK == ok)
@@ -2611,10 +2618,13 @@ TEH_keys_get_timing (const struct TALER_ExchangePublicKeyP *exchange_pub,
hsk = GNUNET_CONTAINER_multipeermap_get (ksh->helpers->esign_keys,
&pid);
meta->start = hsk->start_time;
- meta->expire_sign = GNUNET_TIME_absolute_add (meta->start,
- hsk->validity_duration);
- meta->expire_legal = GNUNET_TIME_absolute_add (meta->expire_sign,
- signkey_legal_duration);
+
+ meta->expire_sign = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->start.abs_time,
+ hsk->validity_duration));
+ meta->expire_legal = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->expire_sign.abs_time,
+ signkey_legal_duration));
return GNUNET_OK;
}
@@ -2653,7 +2663,7 @@ struct FutureBuilderContext
* @param value a `struct HelperDenomination`
* @return #GNUNET_OK (continue to iterate)
*/
-static int
+static enum GNUNET_GenericReturnValue
add_future_denomkey_cb (void *cls,
const struct GNUNET_HashCode *h_denom_pub,
void *value)
@@ -2670,8 +2680,9 @@ add_future_denomkey_cb (void *cls,
if (GNUNET_TIME_relative_is_zero (hd->validity_duration))
return GNUNET_OK; /* this key already expired! */
meta.start = hd->start_time;
- meta.expire_withdraw = GNUNET_TIME_absolute_add (meta.start,
- hd->validity_duration);
+ meta.expire_withdraw = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta.start.abs_time,
+ hd->validity_duration));
if (GNUNET_OK !=
load_extension_data (hd->section_name,
&meta))
@@ -2686,14 +2697,14 @@ add_future_denomkey_cb (void *cls,
GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("value",
&meta.value),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- meta.start),
- GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
- meta.expire_withdraw),
- GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
- meta.expire_deposit),
- GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
- meta.expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ meta.start),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
+ meta.expire_withdraw),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
+ meta.expire_deposit),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
+ meta.expire_legal),
TALER_JSON_pack_denom_pub ("denom_pub",
&hd->denom_pub),
TALER_JSON_pack_amount ("fee_withdraw",
@@ -2723,7 +2734,7 @@ add_future_denomkey_cb (void *cls,
* @param value a `struct HelperDenomination`
* @return #GNUNET_OK (continue to iterate)
*/
-static int
+static enum GNUNET_GenericReturnValue
add_future_signkey_cb (void *cls,
const struct GNUNET_PeerIdentity *pid,
void *value)
@@ -2731,8 +2742,8 @@ add_future_signkey_cb (void *cls,
struct FutureBuilderContext *fbc = cls;
struct HelperSignkey *hsk = value;
struct SigningKey *sk;
- struct GNUNET_TIME_Absolute stamp_expire;
- struct GNUNET_TIME_Absolute legal_end;
+ struct GNUNET_TIME_Timestamp stamp_expire;
+ struct GNUNET_TIME_Timestamp legal_end;
sk = GNUNET_CONTAINER_multipeermap_get (fbc->ksh->signkey_map,
pid);
@@ -2740,22 +2751,24 @@ add_future_signkey_cb (void *cls,
return GNUNET_OK; /* skip: this key is already active */
if (GNUNET_TIME_relative_is_zero (hsk->validity_duration))
return GNUNET_OK; /* this key already expired! */
- stamp_expire = GNUNET_TIME_absolute_add (hsk->start_time,
- hsk->validity_duration);
- legal_end = GNUNET_TIME_absolute_add (stamp_expire,
- signkey_legal_duration);
+ stamp_expire = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (hsk->start_time.abs_time,
+ hsk->validity_duration));
+ legal_end = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (stamp_expire.abs_time,
+ signkey_legal_duration));
GNUNET_assert (0 ==
json_array_append_new (
fbc->signkeys,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("key",
&hsk->exchange_pub),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- hsk->start_time),
- GNUNET_JSON_pack_time_abs ("stamp_expire",
- stamp_expire),
- GNUNET_JSON_pack_time_abs ("stamp_end",
- legal_end),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ hsk->start_time),
+ GNUNET_JSON_pack_timestamp ("stamp_expire",
+ stamp_expire),
+ GNUNET_JSON_pack_timestamp ("stamp_end",
+ legal_end),
GNUNET_JSON_pack_data_auto ("signkey_secmod_sig",
&hsk->sm_sig))));
return GNUNET_OK;
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c
index 1edbbf2aa..7560d6262 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -236,7 +236,7 @@ TEH_handler_kyc_check (
struct KycPoller *kyp = rc->rh_ctx;
MHD_RESULT res;
enum GNUNET_GenericReturnValue ret;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL == kyp)
{
@@ -347,8 +347,7 @@ TEH_handler_kyc_check (
rc);
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ret = TEH_DB_run_transaction (rc->connection,
"kyc check",
TEH_MT_OTHER,
@@ -420,7 +419,7 @@ TEH_handler_kyc_check (
TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS),
.purpose.size = htonl (sizeof (as)),
.h_payto = kyp->h_payto,
- .timestamp = GNUNET_TIME_absolute_hton (now)
+ .timestamp = GNUNET_TIME_timestamp_hton (now)
};
enum TALER_ErrorCode ec;
@@ -440,8 +439,8 @@ TEH_handler_kyc_check (
&sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&pub),
- GNUNET_JSON_pack_time_abs ("now",
- now));
+ GNUNET_JSON_pack_timestamp ("now",
+ now));
}
}
diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c b/src/exchange/taler-exchange-httpd_management_auditors.c
index f9092c53b..6096cc98b 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors.c
@@ -59,7 +59,7 @@ struct AddAuditorContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_start;
+ struct GNUNET_TIME_Timestamp validity_start;
};
@@ -84,7 +84,7 @@ add_auditor (void *cls,
MHD_RESULT *mhd_ret)
{
struct AddAuditorContext *aac = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
@@ -102,7 +102,9 @@ add_auditor (void *cls,
return qs;
}
if ( (0 < qs) &&
- (last_date.abs_value_us > aac->validity_start.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ aac->validity_start) ) )
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -155,8 +157,8 @@ TEH_handler_management_auditors (
&aac.auditor_url),
GNUNET_JSON_spec_string ("auditor_name",
&aac.auditor_name),
- TALER_JSON_spec_absolute_time ("validity_start",
- &aac.validity_start),
+ GNUNET_JSON_spec_timestamp ("validity_start",
+ &aac.validity_start),
GNUNET_JSON_spec_end ()
};
MHD_RESULT res;
diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
index 8b31fb139..5ae0cbd07 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
@@ -50,7 +50,7 @@ struct DelAuditorContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_end;
+ struct GNUNET_TIME_Timestamp validity_end;
};
@@ -75,7 +75,7 @@ del_auditor (void *cls,
MHD_RESULT *mhd_ret)
{
struct DelAuditorContext *dac = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
@@ -92,7 +92,9 @@ del_auditor (void *cls,
"lookup auditor");
return qs;
}
- if (last_date.abs_value_us > dac->validity_end.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ dac->validity_end))
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -145,8 +147,8 @@ TEH_handler_management_auditors_AP_disable (
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
- TALER_JSON_spec_absolute_time ("validity_end",
- &dac.validity_end),
+ GNUNET_JSON_spec_timestamp ("validity_end",
+ &dac.validity_end),
GNUNET_JSON_spec_end ()
};
MHD_RESULT res;
diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c
index 2d37a7204..d776bc353 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c
@@ -50,7 +50,7 @@ struct DelWireContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_end;
+ struct GNUNET_TIME_Timestamp validity_end;
};
@@ -75,7 +75,7 @@ del_wire (void *cls,
MHD_RESULT *mhd_ret)
{
struct DelWireContext *awc = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
@@ -92,7 +92,9 @@ del_wire (void *cls,
"lookup wire");
return qs;
}
- if (last_date.abs_value_us > awc->validity_end.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ awc->validity_end))
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -140,8 +142,8 @@ TEH_handler_management_post_wire_disable (
&awc.master_sig),
GNUNET_JSON_spec_string ("payto_uri",
&awc.payto_uri),
- TALER_JSON_spec_absolute_time ("validity_end",
- &awc.validity_end),
+ GNUNET_JSON_spec_timestamp ("validity_end",
+ &awc.validity_end),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c
index 165c5183d..56828eb5e 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_enable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c
@@ -57,7 +57,7 @@ struct AddWireContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_start;
+ struct GNUNET_TIME_Timestamp validity_start;
};
@@ -82,7 +82,7 @@ add_wire (void *cls,
MHD_RESULT *mhd_ret)
{
struct AddWireContext *awc = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
@@ -100,7 +100,9 @@ add_wire (void *cls,
return qs;
}
if ( (0 < qs) &&
- (last_date.abs_value_us > awc->validity_start.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ awc->validity_start)) )
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -147,8 +149,8 @@ TEH_handler_management_post_wire (
&awc.master_sig_add),
GNUNET_JSON_spec_string ("payto_uri",
&awc.payto_uri),
- TALER_JSON_spec_absolute_time ("validity_start",
- &awc.validity_start),
+ GNUNET_JSON_spec_timestamp ("validity_start",
+ &awc.validity_start),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c
index 180149042..c14500e8d 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_fees.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020 Taler Systems SA
+ Copyright (C) 2020, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -50,12 +50,12 @@ struct AddFeeContext
/**
* Starting period.
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* End of period.
*/
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp end_time;
/**
* Wire fee amount.
@@ -171,10 +171,10 @@ TEH_handler_management_post_wire_fees (
&afc.master_sig),
GNUNET_JSON_spec_string ("wire_method",
&afc.wire_method),
- TALER_JSON_spec_absolute_time ("fee_start",
- &afc.start_time),
- TALER_JSON_spec_absolute_time ("fee_end",
- &afc.end_time),
+ GNUNET_JSON_spec_timestamp ("fee_start",
+ &afc.start_time),
+ GNUNET_JSON_spec_timestamp ("fee_end",
+ &afc.end_time),
TALER_JSON_spec_amount ("closing_fee",
TEH_currency,
&afc.closing_fee),
diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c
index ab7bed295..e4b2af290 100644
--- a/src/exchange/taler-exchange-httpd_melt.c
+++ b/src/exchange/taler-exchange-httpd_melt.c
@@ -319,12 +319,11 @@ check_for_denomination_key (struct MHD_Connection *connection,
&mret);
if (NULL == dk)
return mret;
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_legal))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_legal.abs_time))
{
- 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 ();
/* Way too late now, even zombies have expired */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -333,12 +332,11 @@ check_for_denomination_key (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"MELT");
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
- 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 ();
/* This denomination is not yet valid */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -347,7 +345,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"MELT");
}
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{
/* We are past deposit expiration time, but maybe this is a zombie? */
struct TALER_DenominationHash denom_hash;
@@ -371,10 +369,9 @@ check_for_denomination_key (struct MHD_Connection *connection,
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
- 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 ();
/* We never saw this coin before, so _this_ justification is not OK */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c
index c2cae0861..ec67efc26 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -92,7 +92,7 @@ struct RecoupContext
* Set by #recoup_transaction to the timestamp when the recoup
* was accepted.
*/
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
/**
* true if the client claims the coin originated from a refresh.
@@ -233,8 +233,7 @@ recoup_transaction (void *cls,
}
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
- pc->now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&pc->now);
+ pc->now = GNUNET_TIME_timestamp_get ();
/* add coin to list of wire transfers for recoup */
if (pc->refreshed)
@@ -307,45 +306,33 @@ verify_and_execute_recoup (
&mret);
if (NULL == dk)
return mret;
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is past the expiration time for recoup */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&coin->denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"RECOUP");
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not yet valid */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&coin->denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"RECOUP");
}
if (! dk->recoup_possible)
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not eligible for recoup */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&coin->denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_RECOUP_NOT_ELIGIBLE,
"RECOUP");
}
@@ -530,6 +517,7 @@ TEH_handler_recoup (struct MHD_Connection *connection,
struct TALER_CoinPublicInfo coin;
union TALER_DenominationBlindingKeyP coin_bks;
struct TALER_CoinSpendSignatureP coin_sig;
+ struct TALER_Amount amount;
bool refreshed = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
@@ -540,6 +528,9 @@ TEH_handler_recoup (struct MHD_Connection *connection,
&coin_bks),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&coin_sig),
+ TALER_JSON_spec_amount ("amount",
+ TEH_currency,
+ &amount),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("refreshed",
&refreshed)),
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 6c1766feb..36362a234 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -519,31 +519,23 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
if (NULL == dks[i])
return mret;
- if (GNUNET_TIME_absolute_is_past (dks[i]->meta.expire_withdraw))
+ if (GNUNET_TIME_absolute_is_past (dks[i]->meta.expire_withdraw.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is past the expiration time for withdraws */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&dk_h[i],
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"REVEAL");
}
- if (GNUNET_TIME_absolute_is_future (dks[i]->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dks[i]->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not yet valid */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&dk_h[i],
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"REVEAL");
}
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index cb1179d6d..8c24efc9d 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -96,11 +96,11 @@ TEH_RESPONSE_compile_transaction_history (
&deposit->amount_with_fee),
TALER_JSON_pack_amount ("deposit_fee",
&deposit->deposit_fee),
- GNUNET_JSON_pack_time_abs ("timestamp",
- deposit->timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ deposit->timestamp),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- deposit->refund_deadline)),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ deposit->refund_deadline)),
GNUNET_JSON_pack_data_auto ("merchant_pub",
&deposit->merchant_pub),
GNUNET_JSON_pack_data_auto ("h_contract_terms",
@@ -243,7 +243,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (pr->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (pr->timestamp),
.coin_pub = pr->coin.coin_pub,
.old_coin_pub = pr->old_coin_pub
};
@@ -278,8 +278,8 @@ TEH_RESPONSE_compile_transaction_history (
&epub),
GNUNET_JSON_pack_data_auto ("coin_pub",
&pr->coin.coin_pub),
- GNUNET_JSON_pack_time_abs ("timestamp",
- pr->timestamp))))
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ pr->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -296,7 +296,7 @@ TEH_RESPONSE_compile_transaction_history (
struct TALER_RecoupConfirmationPS pc = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (recoup->timestamp),
.coin_pub = *coin_pub,
.reserve_pub = recoup->reserve_pub
};
@@ -334,8 +334,8 @@ TEH_RESPONSE_compile_transaction_history (
&recoup->coin_blind),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&recoup->reserve_pub),
- GNUNET_JSON_pack_time_abs ("timestamp",
- recoup->timestamp))))
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ recoup->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -353,7 +353,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (pr->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (pr->timestamp),
.coin_pub = *coin_pub,
.old_coin_pub = pr->old_coin_pub
};
@@ -394,8 +394,8 @@ TEH_RESPONSE_compile_transaction_history (
&pr->coin_sig),
GNUNET_JSON_pack_data_auto ("coin_blind",
&pr->coin_blind),
- GNUNET_JSON_pack_time_abs ("timestamp",
- pr->timestamp))))
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ pr->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -418,16 +418,15 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
{
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
enum TALER_ErrorCode ec;
- now = GNUNET_TIME_absolute_get ();
- GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
{
struct TALER_DenominationUnknownAffirmationPS dua = {
.purpose.size = htonl (sizeof (dua)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN),
- .timestamp = GNUNET_TIME_absolute_hton (now),
+ .timestamp = GNUNET_TIME_timestamp_hton (now),
.h_denom_pub = *dph,
};
@@ -447,8 +446,8 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
connection,
MHD_HTTP_NOT_FOUND,
TALER_JSON_pack_ec (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN),
- GNUNET_JSON_pack_time_abs ("timestamp",
- now),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ now),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&epub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -462,7 +461,7 @@ MHD_RESULT
TEH_RESPONSE_reply_expired_denom_pub_hash (
struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
enum TALER_ErrorCode ec,
const char *oper)
{
@@ -473,7 +472,7 @@ TEH_RESPONSE_reply_expired_denom_pub_hash (
.purpose.size = htonl (sizeof (dua)),
.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED),
- .timestamp = GNUNET_TIME_absolute_hton (now),
+ .timestamp = GNUNET_TIME_timestamp_hton (now),
.h_denom_pub = *dph,
};
@@ -499,8 +498,8 @@ TEH_RESPONSE_reply_expired_denom_pub_hash (
TALER_JSON_pack_ec (ec),
GNUNET_JSON_pack_string ("oper",
oper),
- GNUNET_JSON_pack_time_abs ("timestamp",
- now),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ now),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&epub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -607,8 +606,8 @@ TEH_RESPONSE_compile_reserve_history (
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("type",
"CREDIT"),
- GNUNET_JSON_pack_time_abs ("timestamp",
- bank->execution_date),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ bank->execution_date),
GNUNET_JSON_pack_string ("sender_account_url",
bank->sender_account_details),
GNUNET_JSON_pack_uint64 ("wire_reference",
@@ -694,7 +693,7 @@ TEH_RESPONSE_compile_reserve_history (
struct TALER_RecoupConfirmationPS pc = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (recoup->timestamp),
.coin_pub = recoup->coin.coin_pub,
.reserve_pub = recoup->reserve_pub
};
@@ -722,8 +721,8 @@ TEH_RESPONSE_compile_reserve_history (
&pub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
- GNUNET_JSON_pack_time_abs ("timestamp",
- recoup->timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ recoup->timestamp),
TALER_JSON_pack_amount ("amount",
&recoup->value),
GNUNET_JSON_pack_data_auto ("coin_pub",
@@ -765,7 +764,7 @@ TEH_RESPONSE_compile_reserve_history (
struct TALER_ReserveCloseConfirmationPS rcc = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED),
.purpose.size = htonl (sizeof (rcc)),
- .timestamp = GNUNET_TIME_absolute_hton (closing->execution_date),
+ .timestamp = GNUNET_TIME_timestamp_hton (closing->execution_date),
.reserve_pub = pos->details.closing->reserve_pub,
.wtid = closing->wtid
};
@@ -800,8 +799,8 @@ TEH_RESPONSE_compile_reserve_history (
&pub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
- GNUNET_JSON_pack_time_abs ("timestamp",
- closing->execution_date),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ closing->execution_date),
TALER_JSON_pack_amount ("amount",
&value),
TALER_JSON_pack_amount ("closing_fee",
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index 09d566af8..15fc57a58 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -77,7 +77,7 @@ MHD_RESULT
TEH_RESPONSE_reply_expired_denom_pub_hash (
struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
enum TALER_ErrorCode ec,
const char *oper);
diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c
index 38a5c211d..7ca0da974 100644
--- a/src/exchange/taler-exchange-httpd_transfers_get.c
+++ b/src/exchange/taler-exchange-httpd_transfers_get.c
@@ -89,7 +89,7 @@ reply_transfer_details (struct MHD_Connection *connection,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *payto_uri,
const struct TALER_Amount *wire_fee,
- struct GNUNET_TIME_Absolute exec_time,
+ struct GNUNET_TIME_Timestamp exec_time,
const struct AggregatedDepositDetail *wdd_head)
{
json_t *deposits;
@@ -99,7 +99,6 @@ reply_transfer_details (struct MHD_Connection *connection,
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
- GNUNET_TIME_round_abs (&exec_time);
deposits = json_array ();
GNUNET_assert (NULL != deposits);
hash_context = GNUNET_CRYPTO_hash_context_start ();
@@ -108,7 +107,7 @@ reply_transfer_details (struct MHD_Connection *connection,
wdd_pos = wdd_pos->next)
{
dd.h_contract_terms = wdd_pos->h_contract_terms;
- dd.execution_time = GNUNET_TIME_absolute_hton (exec_time);
+ dd.execution_time = GNUNET_TIME_timestamp_hton (exec_time);
dd.coin_pub = wdd_pos->coin_pub;
TALER_amount_hton (&dd.deposit_value,
&wdd_pos->deposit_value);
@@ -175,8 +174,8 @@ reply_transfer_details (struct MHD_Connection *connection,
merchant_pub),
GNUNET_JSON_pack_data_auto ("h_payto",
&wdp.h_payto),
- GNUNET_JSON_pack_time_abs ("execution_time",
- exec_time),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ exec_time),
GNUNET_JSON_pack_array_steal ("deposits",
deposits),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -219,7 +218,7 @@ struct WtidTransactionContext
/**
* Execution time of the wire transfer
*/
- struct GNUNET_TIME_Absolute exec_time;
+ struct GNUNET_TIME_Timestamp exec_time;
/**
* Head of DLL with deposit details for transfers GET response.
@@ -273,7 +272,7 @@ handle_deposit_data (void *cls,
uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri,
- struct GNUNET_TIME_Absolute exec_time,
+ struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@@ -397,8 +396,8 @@ get_transfer_deposits (void *cls,
{
struct WtidTransactionContext *ctx = cls;
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute wire_fee_start_date;
- struct GNUNET_TIME_Absolute wire_fee_end_date;
+ struct GNUNET_TIME_Timestamp wire_fee_start_date;
+ struct GNUNET_TIME_Timestamp wire_fee_end_date;
struct TALER_MasterSignatureP wire_fee_master_sig;
struct TALER_Amount closing_fee;
diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c
index 802204e30..911100583 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -212,8 +212,8 @@ static void
add_wire_fee (void *cls,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterSignatureP *master_sig)
{
json_t *a = cls;
@@ -226,10 +226,10 @@ add_wire_fee (void *cls,
wire_fee),
TALER_JSON_pack_amount ("closing_fee",
closing_fee),
- GNUNET_JSON_pack_time_abs ("start_date",
- start_date),
- GNUNET_JSON_pack_time_abs ("end_date",
- end_date),
+ GNUNET_JSON_pack_timestamp ("start_date",
+ start_date),
+ GNUNET_JSON_pack_timestamp ("end_date",
+ end_date),
GNUNET_JSON_pack_data_auto ("sig",
master_sig))))
{
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
index 9a45271bb..2c5cb4d75 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -141,11 +141,9 @@ withdraw_transaction (void *cls,
bool found = false;
bool balance_ok = false;
uint64_t reserve_uuid;
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ struct GNUNET_TIME_Timestamp now;
+ now = GNUNET_TIME_timestamp_get ();
wc->collectable.reserve_pub = wc->wsrd.reserve_pub;
wc->collectable.h_coin_envelope = wc->wsrd.h_coin_envelope;
qs = TEH_plugin->do_withdraw (TEH_plugin->cls,
@@ -237,7 +235,7 @@ withdraw_transaction (void *cls,
qs2 = TEH_plugin->do_withdraw_limit_check (
TEH_plugin->cls,
reserve_uuid,
- GNUNET_TIME_absolute_subtract (now,
+ GNUNET_TIME_absolute_subtract (now.abs_time,
TEH_kyc_config.withdraw_period),
&TEH_kyc_config.withdraw_limit,
&below_limit);
@@ -355,7 +353,6 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
}
{
MHD_RESULT mret;
- struct GNUNET_TIME_Absolute now;
struct TEH_KeyStateHandle *ksh;
ksh = TEH_keys_get_state ();
@@ -392,14 +389,8 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
GNUNET_JSON_parse_free (spec);
return mret;
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_withdraw))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_withdraw.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is past the expiration time for withdraws */
if (! check_request_idempotent (rc,
&wc,
@@ -409,35 +400,27 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
return TEH_RESPONSE_reply_expired_denom_pub_hash (
rc->connection,
&wc.collectable.denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"WITHDRAW");
}
GNUNET_JSON_parse_free (spec);
return mret;
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not yet valid, no need to check
for idempotency! */
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
rc->connection,
&wc.collectable.denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"WITHDRAW");
}
if (dk->recoup_possible)
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination has been revoked */
if (! check_request_idempotent (rc,
&wc,
@@ -447,7 +430,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
return TEH_RESPONSE_reply_expired_denom_pub_hash (
rc->connection,
&wc.collectable.denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_REVOKED,
"WITHDRAW");
}
diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c
index c2ad59ae5..261b4006f 100644
--- a/src/exchange/taler-exchange-transfer.c
+++ b/src/exchange/taler-exchange-transfer.c
@@ -407,7 +407,7 @@ wire_confirm_cb (void *cls,
unsigned int http_status_code,
enum TALER_ErrorCode ec,
uint64_t row_id,
- struct GNUNET_TIME_Absolute wire_timestamp)
+ struct GNUNET_TIME_Timestamp wire_timestamp)
{
struct WirePrepareData *wpd = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -642,7 +642,8 @@ run_transfers (void *cls)
/* normal case */
break;
}
- shard_delay = GNUNET_TIME_absolute_get_duration (shard->shard_start_time);
+ shard_delay = GNUNET_TIME_absolute_get_duration (
+ shard->shard_start_time);
GNUNET_free (shard);
GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&select_shard,
@@ -776,8 +777,8 @@ select_shard (void *cls)
GNUNET_assert (NULL == task);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Serialization failure, trying again in %s!\n",
- GNUNET_STRINGS_relative_time_to_string (serialization_delay,
- GNUNET_YES));
+ GNUNET_TIME_relative2s (serialization_delay,
+ true));
task = GNUNET_SCHEDULER_add_delayed (serialization_delay,
&select_shard,
NULL);
diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c
index 4b1269606..47606ebc2 100644
--- a/src/exchangedb/irbt_callbacks.c
+++ b/src/exchangedb/irbt_callbacks.c
@@ -43,13 +43,13 @@ irbt_cb_table_denominations (struct PostgresClosure *pg,
&td->details.denominations.denom_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.denominations.master_sig),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.denominations.valid_from),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.denominations.expire_withdraw),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.denominations.expire_deposit),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.denominations.expire_legal),
TALER_PQ_query_param_amount (&td->details.denominations.coin),
TALER_PQ_query_param_amount (
@@ -144,8 +144,8 @@ irbt_cb_table_reserves (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.reserves.reserve_pub),
TALER_PQ_query_param_amount (&td->details.reserves.current_balance),
- TALER_PQ_query_param_absolute_time (&td->details.reserves.expiration_date),
- TALER_PQ_query_param_absolute_time (&td->details.reserves.gc_date),
+ GNUNET_PQ_query_param_timestamp (&td->details.reserves.expiration_date),
+ GNUNET_PQ_query_param_timestamp (&td->details.reserves.gc_date),
GNUNET_PQ_query_param_end
};
@@ -172,7 +172,7 @@ irbt_cb_table_reserves_in (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.sender_account),
GNUNET_PQ_query_param_string (
td->details.reserves_in.exchange_account_section),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.reserves_in.execution_date),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.reserve_uuid),
GNUNET_PQ_query_param_end
@@ -196,7 +196,7 @@ irbt_cb_table_reserves_close (struct PostgresClosure *pg,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.reserves_close.execution_date),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_close.wtid),
@@ -236,7 +236,7 @@ irbt_cb_table_reserves_out (struct PostgresClosure *pg,
&td->details.reserves_out.reserve_uuid),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_out.reserve_sig),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.reserves_out.execution_date),
TALER_PQ_query_param_amount (
&td->details.reserves_out.amount_with_fee),
@@ -266,7 +266,7 @@ irbt_cb_table_auditors (struct PostgresClosure *pg,
GNUNET_PQ_query_param_string (td->details.auditors.auditor_name),
GNUNET_PQ_query_param_string (td->details.auditors.auditor_url),
GNUNET_PQ_query_param_auto_from_type (&is_active),
- GNUNET_PQ_query_param_absolute_time (&td->details.auditors.last_change),
+ GNUNET_PQ_query_param_timestamp (&td->details.auditors.last_change),
GNUNET_PQ_query_param_end
};
@@ -318,11 +318,11 @@ irbt_cb_table_exchange_sign_keys (struct PostgresClosure *pg,
&td->details.exchange_sign_keys.exchange_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.exchange_sign_keys.master_sig),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.exchange_sign_keys.meta.start),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.exchange_sign_keys.meta.expire_sign),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (
&td->details.exchange_sign_keys.meta.expire_legal),
GNUNET_PQ_query_param_end
};
@@ -503,11 +503,11 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.known_coin_id),
TALER_PQ_query_param_amount (&td->details.deposits.amount_with_fee),
- TALER_PQ_query_param_absolute_time (&td->details.deposits.wallet_timestamp),
- TALER_PQ_query_param_absolute_time (
+ GNUNET_PQ_query_param_timestamp (&td->details.deposits.wallet_timestamp),
+ GNUNET_PQ_query_param_timestamp (
&td->details.deposits.exchange_timestamp),
- TALER_PQ_query_param_absolute_time (&td->details.deposits.refund_deadline),
- TALER_PQ_query_param_absolute_time (&td->details.deposits.wire_deadline),
+ GNUNET_PQ_query_param_timestamp (&td->details.deposits.refund_deadline),
+ GNUNET_PQ_query_param_timestamp (&td->details.deposits.wire_deadline),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.merchant_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.deposits.h_contract_terms),
@@ -565,7 +565,7 @@ irbt_cb_table_wire_out (struct PostgresClosure *pg,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
- TALER_PQ_query_param_absolute_time (&td->details.wire_out.execution_date),
+ GNUNET_PQ_query_param_timestamp (&td->details.wire_out.execution_date),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_out.wtid_raw),
GNUNET_PQ_query_param_uint64 (&td->details.wire_out.wire_target_serial_id),
GNUNET_PQ_query_param_string (
@@ -618,8 +618,8 @@ irbt_cb_table_wire_fee (struct PostgresClosure *pg,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_string (td->details.wire_fee.wire_method),
- TALER_PQ_query_param_absolute_time (&td->details.wire_fee.start_date),
- TALER_PQ_query_param_absolute_time (&td->details.wire_fee.end_date),
+ GNUNET_PQ_query_param_timestamp (&td->details.wire_fee.start_date),
+ GNUNET_PQ_query_param_timestamp (&td->details.wire_fee.end_date),
TALER_PQ_query_param_amount (&td->details.wire_fee.wire_fee),
TALER_PQ_query_param_amount (&td->details.wire_fee.closing_fee),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_fee.master_sig),
@@ -647,7 +647,7 @@ irbt_cb_table_recoup (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_sig),
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_blind),
TALER_PQ_query_param_amount (&td->details.recoup.amount),
- TALER_PQ_query_param_absolute_time (&td->details.recoup.timestamp),
+ GNUNET_PQ_query_param_timestamp (&td->details.recoup.timestamp),
GNUNET_PQ_query_param_uint64 (&td->details.recoup.known_coin_id),
GNUNET_PQ_query_param_uint64 (&td->details.recoup.reserve_out_serial_id),
GNUNET_PQ_query_param_end
@@ -675,7 +675,7 @@ irbt_cb_table_recoup_refresh (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (
&td->details.recoup_refresh.coin_blind),
TALER_PQ_query_param_amount (&td->details.recoup_refresh.amount),
- TALER_PQ_query_param_absolute_time (&td->details.recoup_refresh.timestamp),
+ GNUNET_PQ_query_param_timestamp (&td->details.recoup_refresh.timestamp),
GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.known_coin_id),
GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.rrc_serial),
GNUNET_PQ_query_param_end
diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c
index 5a26a5d6b..6dc990dc2 100644
--- a/src/exchangedb/lrbt_callbacks.c
+++ b/src/exchangedb/lrbt_callbacks.c
@@ -61,18 +61,18 @@ lrbt_cb_table_denominations (void *cls,
GNUNET_PQ_result_spec_auto_from_type (
"master_sig",
&td.details.denominations.master_sig),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"valid_from",
&td.details.denominations.valid_from),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"expire_withdraw",
&td.details.denominations.
expire_withdraw),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"expire_deposit",
&td.details.denominations.
expire_deposit),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"expire_legal",
&td.details.denominations.expire_legal),
TALER_PQ_RESULT_SPEC_AMOUNT (
@@ -230,10 +230,10 @@ lrbt_cb_table_reserves (void *cls,
&td.details.reserves.reserve_pub),
TALER_PQ_RESULT_SPEC_AMOUNT ("current_balance",
&td.details.reserves.current_balance),
- TALER_PQ_result_spec_absolute_time ("expiration_date",
- &td.details.reserves.expiration_date),
- TALER_PQ_result_spec_absolute_time ("gc_date",
- &td.details.reserves.gc_date),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &td.details.reserves.expiration_date),
+ GNUNET_PQ_result_spec_timestamp ("gc_date",
+ &td.details.reserves.gc_date),
GNUNET_PQ_result_spec_end
};
@@ -292,7 +292,7 @@ lrbt_cb_table_reserves_in (void *cls,
GNUNET_PQ_result_spec_string (
"exchange_account_section",
&td.details.reserves_in.exchange_account_section),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.reserves_in.execution_date),
GNUNET_PQ_result_spec_end
@@ -341,7 +341,7 @@ lrbt_cb_table_reserves_close (void *cls,
GNUNET_PQ_result_spec_uint64 (
"reserve_uuid",
&td.details.reserves_close.reserve_uuid),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.reserves_close.execution_date),
GNUNET_PQ_result_spec_auto_from_type (
@@ -414,7 +414,7 @@ lrbt_cb_table_reserves_out (void *cls,
GNUNET_PQ_result_spec_auto_from_type (
"reserve_sig",
&td.details.reserves_out.reserve_sig),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.reserves_out.execution_date),
TALER_PQ_RESULT_SPEC_AMOUNT (
@@ -470,8 +470,8 @@ lrbt_cb_table_auditors (void *cls,
&td.details.auditors.auditor_name),
GNUNET_PQ_result_spec_auto_from_type ("is_active",
&is_active8),
- TALER_PQ_result_spec_absolute_time ("last_change",
- &td.details.auditors.last_change),
+ GNUNET_PQ_result_spec_timestamp ("last_change",
+ &td.details.auditors.last_change),
GNUNET_PQ_result_spec_end
};
@@ -571,15 +571,15 @@ lrbt_cb_table_exchange_sign_keys (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&td.details.exchange_sign_keys.
master_sig),
- TALER_PQ_result_spec_absolute_time ("valid_from",
- &td.details.exchange_sign_keys.meta.
- start),
- TALER_PQ_result_spec_absolute_time ("expire_sign",
- &td.details.exchange_sign_keys.meta.
- expire_sign),
- TALER_PQ_result_spec_absolute_time ("expire_legal",
- &td.details.exchange_sign_keys.meta.
- expire_legal),
+ GNUNET_PQ_result_spec_timestamp ("valid_from",
+ &td.details.exchange_sign_keys.meta.
+ start),
+ GNUNET_PQ_result_spec_timestamp ("expire_sign",
+ &td.details.exchange_sign_keys.meta.
+ expire_sign),
+ GNUNET_PQ_result_spec_timestamp ("expire_legal",
+ &td.details.exchange_sign_keys.meta.
+ expire_legal),
GNUNET_PQ_result_spec_end
};
@@ -916,16 +916,16 @@ lrbt_cb_table_deposits (void *cls,
TALER_PQ_RESULT_SPEC_AMOUNT (
"amount_with_fee",
&td.details.deposits.amount_with_fee),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"wallet_timestamp",
&td.details.deposits.wallet_timestamp),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"exchange_timestamp",
&td.details.deposits.exchange_timestamp),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"refund_deadline",
&td.details.deposits.refund_deadline),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"wire_deadline",
&td.details.deposits.wire_deadline),
GNUNET_PQ_result_spec_auto_from_type (
@@ -1054,7 +1054,7 @@ lrbt_cb_table_wire_out (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("serial",
&td.serial),
- TALER_PQ_result_spec_absolute_time (
+ GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.wire_out.execution_date),
GNUNET_PQ_result_spec_auto_from_type (
@@ -1161,10 +1161,10 @@ lrbt_cb_table_wire_fee (void *cls,
&td.serial),
GNUNET_PQ_result_spec_string ("wire_method",
&td.details.wire_fee.wire_method),
- TALER_PQ_result_spec_absolute_time ("start_date",
- &td.details.wire_fee.start_date),
- TALER_PQ_result_spec_absolute_time ("end_date",
- &td.details.wire_fee.end_date),
+ GNUNET_PQ_result_spec_timestamp ("start_date",
+ &td.details.wire_fee.start_date),
+ GNUNET_PQ_result_spec_timestamp ("end_date",
+ &td.details.wire_fee.end_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
&td.details.wire_fee.wire_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
@@ -1219,8 +1219,8 @@ lrbt_cb_table_recoup (void *cls,
&td.details.recoup.coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&td.details.recoup.amount),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &td.details.recoup.timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &td.details.recoup.timestamp),
GNUNET_PQ_result_spec_uint64 ("known_coin_id",
&td.details.recoup.known_coin_id),
GNUNET_PQ_result_spec_uint64 ("reserve_out_serial_id",
@@ -1274,8 +1274,8 @@ lrbt_cb_table_recoup_refresh (void *cls,
&td.details.recoup_refresh.coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&td.details.recoup_refresh.amount),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &td.details.recoup_refresh.timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &td.details.recoup_refresh.timestamp),
GNUNET_PQ_result_spec_uint64 ("known_coin_id",
&td.details.recoup_refresh.known_coin_id),
GNUNET_PQ_result_spec_uint64 ("rrc_serial",
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 8e184a9dd..23307bf80 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -3149,10 +3149,10 @@ postgres_insert_denomination_info (
GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash),
TALER_PQ_query_param_denom_pub (denom_pub),
GNUNET_PQ_query_param_auto_from_type (&issue->signature),
- TALER_PQ_query_param_absolute_time_nbo (&issue->properties.start),
- TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_withdraw),
- TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_deposit),
- TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_legal),
+ GNUNET_PQ_query_param_timestamp_nbo (&issue->properties.start),
+ GNUNET_PQ_query_param_timestamp_nbo (&issue->properties.expire_withdraw),
+ GNUNET_PQ_query_param_timestamp_nbo (&issue->properties.expire_deposit),
+ GNUNET_PQ_query_param_timestamp_nbo (&issue->properties.expire_legal),
TALER_PQ_query_param_amount_nbo (&issue->properties.value),
TALER_PQ_query_param_amount_nbo (&issue->properties.fee_withdraw),
TALER_PQ_query_param_amount_nbo (&issue->properties.fee_deposit),
@@ -3161,14 +3161,18 @@ postgres_insert_denomination_info (
GNUNET_PQ_query_param_end
};
- GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
- issue->properties.start).abs_value_us);
- GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
- issue->properties.expire_withdraw).abs_value_us);
- GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
- issue->properties.expire_deposit).abs_value_us);
- GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
- issue->properties.expire_legal).abs_value_us);
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
+ GNUNET_TIME_timestamp_ntoh (
+ issue->properties.start).abs_time));
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
+ GNUNET_TIME_timestamp_ntoh (
+ issue->properties.expire_withdraw).abs_time));
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
+ GNUNET_TIME_timestamp_ntoh (
+ issue->properties.expire_deposit).abs_time));
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
+ GNUNET_TIME_timestamp_ntoh (
+ issue->properties.expire_legal).abs_time));
/* check fees match coin currency */
GNUNET_assert (GNUNET_YES ==
TALER_amount_cmp_currency_nbo (&issue->properties.value,
@@ -3212,14 +3216,14 @@ postgres_get_denomination_info (
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&issue->signature),
- TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
- &issue->properties.start),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_withdraw",
- &issue->properties.expire_withdraw),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_deposit",
- &issue->properties.expire_deposit),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_legal",
- &issue->properties.expire_legal),
+ GNUNET_PQ_result_spec_timestamp_nbo ("valid_from",
+ &issue->properties.start),
+ GNUNET_PQ_result_spec_timestamp_nbo ("expire_withdraw",
+ &issue->properties.expire_withdraw),
+ GNUNET_PQ_result_spec_timestamp_nbo ("expire_deposit",
+ &issue->properties.expire_deposit),
+ GNUNET_PQ_result_spec_timestamp_nbo ("expire_legal",
+ &issue->properties.expire_legal),
TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("coin",
&issue->properties.value),
TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_withdraw",
@@ -3296,14 +3300,14 @@ domination_cb_helper (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&issue.signature),
- TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
- &issue.properties.start),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_withdraw",
- &issue.properties.expire_withdraw),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_deposit",
- &issue.properties.expire_deposit),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_legal",
- &issue.properties.expire_legal),
+ GNUNET_PQ_result_spec_timestamp_nbo ("valid_from",
+ &issue.properties.start),
+ GNUNET_PQ_result_spec_timestamp_nbo ("expire_withdraw",
+ &issue.properties.expire_withdraw),
+ GNUNET_PQ_result_spec_timestamp_nbo ("expire_deposit",
+ &issue.properties.expire_deposit),
+ GNUNET_PQ_result_spec_timestamp_nbo ("expire_legal",
+ &issue.properties.expire_legal),
TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("coin",
&issue.properties.value),
TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_withdraw",
@@ -3425,14 +3429,14 @@ dominations_cb_helper (void *cls,
&master_sig),
GNUNET_PQ_result_spec_bool ("revoked",
&revoked),
- TALER_PQ_result_spec_absolute_time ("valid_from",
- &meta.start),
- TALER_PQ_result_spec_absolute_time ("expire_withdraw",
- &meta.expire_withdraw),
- TALER_PQ_result_spec_absolute_time ("expire_deposit",
- &meta.expire_deposit),
- TALER_PQ_result_spec_absolute_time ("expire_legal",
- &meta.expire_legal),
+ GNUNET_PQ_result_spec_timestamp ("valid_from",
+ &meta.start),
+ GNUNET_PQ_result_spec_timestamp ("expire_withdraw",
+ &meta.expire_withdraw),
+ GNUNET_PQ_result_spec_timestamp ("expire_deposit",
+ &meta.expire_deposit),
+ GNUNET_PQ_result_spec_timestamp ("expire_legal",
+ &meta.expire_legal),
TALER_PQ_RESULT_SPEC_AMOUNT ("coin",
&meta.value),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_withdraw",
@@ -3546,12 +3550,12 @@ signkeys_cb_helper (void *cls,
&master_sig),
GNUNET_PQ_result_spec_auto_from_type ("exchange_pub",
&exchange_pub),
- TALER_PQ_result_spec_absolute_time ("valid_from",
- &meta.start),
- TALER_PQ_result_spec_absolute_time ("expire_sign",
- &meta.expire_sign),
- TALER_PQ_result_spec_absolute_time ("expire_legal",
- &meta.expire_legal),
+ GNUNET_PQ_result_spec_timestamp ("valid_from",
+ &meta.start),
+ GNUNET_PQ_result_spec_timestamp ("expire_sign",
+ &meta.expire_sign),
+ GNUNET_PQ_result_spec_timestamp ("expire_legal",
+ &meta.expire_legal),
GNUNET_PQ_result_spec_end
};
@@ -3821,10 +3825,10 @@ postgres_reserves_get (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("current_balance",
&reserve->balance),
- TALER_PQ_result_spec_absolute_time ("expiration_date",
- &reserve->expiry),
- TALER_PQ_result_spec_absolute_time ("gc_date",
- &reserve->gc),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &reserve->expiry),
+ GNUNET_PQ_result_spec_timestamp ("gc_date",
+ &reserve->gc),
GNUNET_PQ_result_spec_uint64 ("payment_target_uuid",
&kyc->payment_target_uuid),
GNUNET_PQ_result_spec_bool ("kyc_ok",
@@ -4086,10 +4090,10 @@ reserves_get_internal (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("current_balance",
&reserve->balance),
- TALER_PQ_result_spec_absolute_time ("expiration_date",
- &reserve->expiry),
- TALER_PQ_result_spec_absolute_time ("gc_date",
- &reserve->gc),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &reserve->expiry),
+ GNUNET_PQ_result_spec_timestamp ("gc_date",
+ &reserve->gc),
GNUNET_PQ_result_spec_end
};
@@ -4114,8 +4118,8 @@ reserves_update (void *cls,
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- TALER_PQ_query_param_absolute_time (&reserve->expiry),
- TALER_PQ_query_param_absolute_time (&reserve->gc),
+ GNUNET_PQ_query_param_timestamp (&reserve->expiry),
+ GNUNET_PQ_query_param_timestamp (&reserve->gc),
TALER_PQ_query_param_amount (&reserve->balance),
GNUNET_PQ_query_param_auto_from_type (&reserve->pub),
GNUNET_PQ_query_param_end
@@ -4172,7 +4176,7 @@ static enum GNUNET_DB_QueryStatus
postgres_reserves_in_insert (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *balance,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const char *sender_account_details,
const char *exchange_account_section,
uint64_t wire_ref)
@@ -4180,20 +4184,17 @@ postgres_reserves_in_insert (void *cls,
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs1;
struct TALER_EXCHANGEDB_Reserve reserve;
- struct GNUNET_TIME_Absolute expiry;
- struct GNUNET_TIME_Absolute gc;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp expiry;
+ struct GNUNET_TIME_Timestamp gc;
uint64_t reserve_uuid;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
reserve.pub = *reserve_pub;
- expiry = GNUNET_TIME_absolute_add (execution_time,
- pg->idle_reserve_expiration_time);
- (void) GNUNET_TIME_round_abs (&expiry);
- gc = GNUNET_TIME_absolute_add (now,
- pg->legal_reserve_expiration_time);
- (void) GNUNET_TIME_round_abs (&gc);
+ expiry = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (execution_time.abs_time,
+ pg->idle_reserve_expiration_time));
+ gc = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
+ pg->legal_reserve_expiration_time));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating reserve %s with expiration in %s\n",
TALER_B2S (reserve_pub),
@@ -4208,8 +4209,8 @@ postgres_reserves_in_insert (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
TALER_PQ_query_param_amount (balance),
- TALER_PQ_query_param_absolute_time (&expiry),
- TALER_PQ_query_param_absolute_time (&gc),
+ GNUNET_PQ_query_param_timestamp (&expiry),
+ GNUNET_PQ_query_param_timestamp (&gc),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -4257,7 +4258,7 @@ postgres_reserves_in_insert (void *cls,
TALER_PQ_query_param_amount (balance),
GNUNET_PQ_query_param_string (exchange_account_section),
GNUNET_PQ_query_param_uint64 (&kyc.payment_target_uuid),
- TALER_PQ_query_param_absolute_time (&execution_time),
+ GNUNET_PQ_query_param_timestamp (&execution_time),
GNUNET_PQ_query_param_end
};
@@ -4274,7 +4275,7 @@ postgres_reserves_in_insert (void *cls,
TALER_PQ_query_param_amount (balance),
GNUNET_PQ_query_param_string (exchange_account_section),
GNUNET_PQ_query_param_uint64 (&kyc.payment_target_uuid),
- TALER_PQ_query_param_absolute_time (&execution_time),
+ GNUNET_PQ_query_param_timestamp (&execution_time),
GNUNET_PQ_query_param_end
};
@@ -4367,12 +4368,10 @@ postgres_reserves_in_insert (void *cls,
"Attempt to deposit incompatible amount into reserve\n");
return GNUNET_DB_STATUS_HARD_ERROR;
}
- updated_reserve.expiry = GNUNET_TIME_absolute_max (expiry,
- reserve.expiry);
- (void) GNUNET_TIME_round_abs (&updated_reserve.expiry);
- updated_reserve.gc = GNUNET_TIME_absolute_max (gc,
- reserve.gc);
- (void) GNUNET_TIME_round_abs (&updated_reserve.gc);
+ updated_reserve.expiry = GNUNET_TIME_timestamp_max (expiry,
+ reserve.expiry);
+ updated_reserve.gc = GNUNET_TIME_timestamp_max (gc,
+ reserve.gc);
qs3 = reserves_update (pg,
&updated_reserve);
switch (qs3)
@@ -4566,14 +4565,14 @@ static enum GNUNET_DB_QueryStatus
postgres_do_withdraw (
void *cls,
const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
bool *found,
bool *balance_ok,
struct TALER_EXCHANGEDB_KycStatus *kyc,
uint64_t *reserve_uuid)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute gc;
+ struct GNUNET_TIME_Timestamp gc;
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (&collectable->amount_with_fee),
GNUNET_PQ_query_param_auto_from_type (&collectable->denom_pub_hash),
@@ -4581,8 +4580,8 @@ postgres_do_withdraw (
GNUNET_PQ_query_param_auto_from_type (&collectable->reserve_sig),
GNUNET_PQ_query_param_auto_from_type (&collectable->h_coin_envelope),
TALER_PQ_query_param_blinded_denom_sig (&collectable->sig),
- TALER_PQ_query_param_absolute_time (&now),
- TALER_PQ_query_param_absolute_time (&gc),
+ GNUNET_PQ_query_param_timestamp (&now),
+ GNUNET_PQ_query_param_timestamp (&gc),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -4599,9 +4598,9 @@ postgres_do_withdraw (
GNUNET_PQ_result_spec_end
};
- gc = GNUNET_TIME_absolute_add (now,
- pg->legal_reserve_expiration_time);
- (void) GNUNET_TIME_round_abs (&gc);
+ gc = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (now.abs_time,
+ pg->legal_reserve_expiration_time));
kyc->type = TALER_EXCHANGEDB_KYC_WITHDRAW;
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"call_withdraw",
@@ -4633,7 +4632,7 @@ postgres_do_withdraw_limit_check (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&reserve_uuid),
- TALER_PQ_query_param_absolute_time (&withdraw_start),
+ GNUNET_PQ_query_param_absolute_time (&withdraw_start),
TALER_PQ_query_param_amount (upper_limit),
GNUNET_PQ_query_param_end
};
@@ -4748,8 +4747,8 @@ add_bank_to_exchange (void *cls,
&bt->wire_reference),
TALER_PQ_RESULT_SPEC_AMOUNT ("credit",
&bt->amount),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &bt->execution_date),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &bt->execution_date),
GNUNET_PQ_result_spec_string ("sender_account_details",
&bt->sender_account_details),
GNUNET_PQ_result_spec_end
@@ -4870,8 +4869,8 @@ add_recoup (void *cls,
&recoup->coin_blind),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&recoup->coin_sig),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &recoup->timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &recoup->timestamp),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&recoup->coin.denom_pub_hash),
TALER_PQ_result_spec_denom_sig (
@@ -4931,8 +4930,8 @@ add_exchange_to_bank (void *cls,
&closing->amount),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
&closing->closing_fee),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &closing->execution_date),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &closing->execution_date),
GNUNET_PQ_result_spec_string ("receiver_account",
&closing->receiver_account_details),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
@@ -5152,9 +5151,10 @@ postgres_select_withdraw_amounts_by_account (
.cb = cb,
.cb_cls = cb_cls
};
- struct GNUNET_TIME_Absolute start
- = GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (),
- duration);
+ struct GNUNET_TIME_Absolute start;
+
+ start = GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (),
+ duration);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_absolute_time (&start),
@@ -5193,7 +5193,7 @@ static enum GNUNET_DB_QueryStatus
postgres_have_deposit (void *cls,
const struct TALER_EXCHANGEDB_Deposit *deposit,
struct TALER_Amount *deposit_fee,
- struct GNUNET_TIME_Absolute *exchange_timestamp)
+ struct GNUNET_TIME_Timestamp *exchange_timestamp)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -5206,14 +5206,14 @@ postgres_have_deposit (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&deposit2.amount_with_fee),
- TALER_PQ_result_spec_absolute_time ("wallet_timestamp",
- &deposit2.timestamp),
- TALER_PQ_result_spec_absolute_time ("exchange_timestamp",
- exchange_timestamp),
- TALER_PQ_result_spec_absolute_time ("refund_deadline",
- &deposit2.refund_deadline),
- TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &deposit2.wire_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wallet_timestamp",
+ &deposit2.timestamp),
+ GNUNET_PQ_result_spec_timestamp ("exchange_timestamp",
+ exchange_timestamp),
+ GNUNET_PQ_result_spec_timestamp ("refund_deadline",
+ &deposit2.refund_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ &deposit2.wire_deadline),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
deposit_fee),
GNUNET_PQ_result_spec_auto_from_type ("wire_salt",
@@ -5246,10 +5246,12 @@ postgres_have_deposit (void *cls,
also matches, and if not report inconsistencies. */
if ( (0 != TALER_amount_cmp (&deposit->amount_with_fee,
&deposit2.amount_with_fee)) ||
- (deposit->timestamp.abs_value_us !=
- deposit2.timestamp.abs_value_us) ||
- (deposit->refund_deadline.abs_value_us !=
- deposit2.refund_deadline.abs_value_us) ||
+ (GNUNET_TIME_timestamp_cmp (deposit->timestamp,
+ !=,
+ deposit2.timestamp)) ||
+ (GNUNET_TIME_timestamp_cmp (deposit->refund_deadline,
+ !=,
+ deposit2.refund_deadline)) ||
(0 != strcmp (deposit->receiver_wire_account,
deposit2.receiver_wire_account)) ||
(0 != GNUNET_memcmp (&deposit->wire_salt,
@@ -5289,9 +5291,9 @@ postgres_have_deposit2 (
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
struct TALER_Amount *deposit_fee,
- struct GNUNET_TIME_Absolute *exchange_timestamp)
+ struct GNUNET_TIME_Timestamp *exchange_timestamp)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -5304,14 +5306,14 @@ postgres_have_deposit2 (
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&deposit2.amount_with_fee),
- TALER_PQ_result_spec_absolute_time ("wallet_timestamp",
- &deposit2.timestamp),
- TALER_PQ_result_spec_absolute_time ("exchange_timestamp",
- exchange_timestamp),
- TALER_PQ_result_spec_absolute_time ("refund_deadline",
- &deposit2.refund_deadline),
- TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &deposit2.wire_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wallet_timestamp",
+ &deposit2.timestamp),
+ GNUNET_PQ_result_spec_timestamp ("exchange_timestamp",
+ exchange_timestamp),
+ GNUNET_PQ_result_spec_timestamp ("refund_deadline",
+ &deposit2.refund_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ &deposit2.wire_deadline),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
deposit_fee),
GNUNET_PQ_result_spec_auto_from_type ("wire_salt",
@@ -5347,8 +5349,9 @@ postgres_have_deposit2 (
GNUNET_free (deposit2.receiver_wire_account);
/* Now we check that the other information in @a deposit
also matches, and if not report inconsistencies. */
- if ( (refund_deadline.abs_value_us !=
- deposit2.refund_deadline.abs_value_us) ||
+ if ( (GNUNET_TIME_timestamp_cmp (refund_deadline,
+ !=,
+ deposit2.refund_deadline)) ||
(0 != GNUNET_memcmp (h_wire,
&h_wire2) ) )
{
@@ -5435,9 +5438,9 @@ postgres_get_ready_deposit (void *cls,
void *deposit_cb_cls)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Absolute now;
struct GNUNET_PQ_QueryParam params[] = {
- TALER_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_uint64 (&start_shard_row),
GNUNET_PQ_query_param_uint64 (&end_shard_row),
GNUNET_PQ_query_param_bool (kyc_off),
@@ -5472,12 +5475,12 @@ postgres_get_ready_deposit (void *cls,
};
enum GNUNET_DB_QueryStatus qs;
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_absolute_get ();
GNUNET_assert (start_shard_row < end_shard_row);
GNUNET_assert (end_shard_row <= INT32_MAX);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Finding ready deposits by deadline %s (%llu)\n",
- GNUNET_STRINGS_absolute_time_to_string (now),
+ GNUNET_TIME_absolute2s (now),
(unsigned long long) now.abs_value_us);
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
@@ -5633,7 +5636,7 @@ postgres_iterate_matching_deposits (
uint32_t limit)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_uint64 (&wire_target),
@@ -5650,8 +5653,6 @@ postgres_iterate_matching_deposits (
};
enum GNUNET_DB_QueryStatus qs;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
"deposits_iterate_matching",
params,
@@ -5917,7 +5918,7 @@ compute_shard (const struct TALER_EXCHANGEDB_Deposit *deposit)
*/
static enum GNUNET_DB_QueryStatus
postgres_insert_deposit (void *cls,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit)
{
struct PostgresClosure *pg = cls;
@@ -5937,25 +5938,26 @@ postgres_insert_deposit (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&deposit->coin.coin_pub),
TALER_PQ_query_param_amount (&deposit->amount_with_fee),
- TALER_PQ_query_param_absolute_time (&deposit->timestamp),
- TALER_PQ_query_param_absolute_time (&deposit->refund_deadline),
- TALER_PQ_query_param_absolute_time (&deposit->wire_deadline),
+ GNUNET_PQ_query_param_timestamp (&deposit->timestamp),
+ GNUNET_PQ_query_param_timestamp (&deposit->refund_deadline),
+ GNUNET_PQ_query_param_timestamp (&deposit->wire_deadline),
GNUNET_PQ_query_param_auto_from_type (&deposit->merchant_pub),
GNUNET_PQ_query_param_auto_from_type (&deposit->h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (&deposit->wire_salt),
GNUNET_PQ_query_param_uint64 (&kyc.payment_target_uuid),
GNUNET_PQ_query_param_auto_from_type (&deposit->csig),
- TALER_PQ_query_param_absolute_time (&exchange_timestamp),
+ GNUNET_PQ_query_param_timestamp (&exchange_timestamp),
GNUNET_PQ_query_param_uint64 (&shard),
GNUNET_PQ_query_param_end
};
GNUNET_assert (shard <= INT32_MAX);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Inserting deposit to be executed at %s (%llu/%llu)\n",
- GNUNET_STRINGS_absolute_time_to_string (deposit->wire_deadline),
- (unsigned long long) deposit->wire_deadline.abs_value_us,
- (unsigned long long) deposit->refund_deadline.abs_value_us);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_INFO,
+ "Inserting deposit to be executed at %s (%llu/%llu)\n",
+ GNUNET_TIME_timestamp2s (deposit->wire_deadline),
+ (unsigned long long) deposit->wire_deadline.abs_time.abs_value_us,
+ (unsigned long long) deposit->refund_deadline.abs_time.abs_value_us);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_deposit",
params);
@@ -6739,12 +6741,12 @@ add_coin_deposit (void *cls,
&deposit->amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
&deposit->deposit_fee),
- TALER_PQ_result_spec_absolute_time ("wallet_timestamp",
- &deposit->timestamp),
- TALER_PQ_result_spec_absolute_time ("refund_deadline",
- &deposit->refund_deadline),
- TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &deposit->wire_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wallet_timestamp",
+ &deposit->timestamp),
+ GNUNET_PQ_result_spec_timestamp ("refund_deadline",
+ &deposit->refund_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ &deposit->wire_deadline),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&deposit->h_denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
@@ -6944,8 +6946,8 @@ add_old_coin_recoup (void *cls,
&recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&recoup->value),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &recoup->timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &recoup->timestamp),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&recoup->coin.denom_pub_hash),
TALER_PQ_result_spec_denom_sig ("denom_sig",
@@ -7012,8 +7014,8 @@ add_coin_recoup (void *cls,
&recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&recoup->value),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &recoup->timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &recoup->timestamp),
GNUNET_PQ_result_spec_uint64 ("recoup_uuid",
&serial_id),
GNUNET_PQ_result_spec_end
@@ -7073,8 +7075,8 @@ add_coin_recoup_refresh (void *cls,
&recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&recoup->value),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &recoup->timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &recoup->timestamp),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&recoup->coin.denom_pub_hash),
TALER_PQ_result_spec_denom_sig ("denom_sig",
@@ -7272,7 +7274,7 @@ handle_wt_result (void *cls,
struct TALER_PrivateContractHash h_contract_terms;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_MerchantPublicKeyP merchant_pub;
- struct GNUNET_TIME_Absolute exec_time;
+ struct GNUNET_TIME_Timestamp exec_time;
struct TALER_Amount amount_with_fee;
struct TALER_Amount deposit_fee;
struct TALER_DenominationPublicKey denom_pub;
@@ -7289,8 +7291,8 @@ handle_wt_result (void *cls,
&coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
&merchant_pub),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &exec_time),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &exec_time),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
@@ -7392,7 +7394,7 @@ postgres_lookup_transfer_by_deposit (
const struct TALER_MerchantPublicKeyP *merchant_pub,
bool *pending,
struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute *exec_time,
+ struct GNUNET_TIME_Timestamp *exec_time,
struct TALER_Amount *amount_with_fee,
struct TALER_Amount *deposit_fee,
struct TALER_EXCHANGEDB_KycStatus *kyc)
@@ -7414,8 +7416,8 @@ postgres_lookup_transfer_by_deposit (
&wire_salt),
GNUNET_PQ_result_spec_string ("payto_uri",
&payto_uri),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- exec_time),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ exec_time),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
@@ -7476,8 +7478,8 @@ postgres_lookup_transfer_by_deposit (
amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
deposit_fee),
- TALER_PQ_result_spec_absolute_time ("wire_deadline",
- exec_time),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ exec_time),
GNUNET_PQ_result_spec_end
};
@@ -7548,9 +7550,9 @@ postgres_insert_aggregation_tracking (
static enum GNUNET_DB_QueryStatus
postgres_get_wire_fee (void *cls,
const char *type,
- struct GNUNET_TIME_Absolute date,
- struct GNUNET_TIME_Absolute *start_date,
- struct GNUNET_TIME_Absolute *end_date,
+ struct GNUNET_TIME_Timestamp date,
+ struct GNUNET_TIME_Timestamp *start_date,
+ struct GNUNET_TIME_Timestamp *end_date,
struct TALER_Amount *wire_fee,
struct TALER_Amount *closing_fee,
struct TALER_MasterSignatureP *master_sig)
@@ -7558,12 +7560,12 @@ postgres_get_wire_fee (void *cls,
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (type),
- TALER_PQ_query_param_absolute_time (&date),
+ GNUNET_PQ_query_param_timestamp (&date),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("start_date", start_date),
- TALER_PQ_result_spec_absolute_time ("end_date", end_date),
+ GNUNET_PQ_result_spec_timestamp ("start_date", start_date),
+ GNUNET_PQ_result_spec_timestamp ("end_date", end_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee", wire_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee", closing_fee),
GNUNET_PQ_result_spec_auto_from_type ("master_sig", master_sig),
@@ -7592,8 +7594,8 @@ postgres_get_wire_fee (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_wire_fee (void *cls,
const char *type,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig)
@@ -7601,8 +7603,8 @@ postgres_insert_wire_fee (void *cls,
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (type),
- TALER_PQ_query_param_absolute_time (&start_date),
- TALER_PQ_query_param_absolute_time (&end_date),
+ GNUNET_PQ_query_param_timestamp (&start_date),
+ GNUNET_PQ_query_param_timestamp (&end_date),
TALER_PQ_query_param_amount (wire_fee),
TALER_PQ_query_param_amount (closing_fee),
GNUNET_PQ_query_param_auto_from_type (master_sig),
@@ -7611,8 +7613,8 @@ postgres_insert_wire_fee (void *cls,
struct TALER_Amount wf;
struct TALER_Amount cf;
struct TALER_MasterSignatureP sig;
- struct GNUNET_TIME_Absolute sd;
- struct GNUNET_TIME_Absolute ed;
+ struct GNUNET_TIME_Timestamp sd;
+ struct GNUNET_TIME_Timestamp ed;
enum GNUNET_DB_QueryStatus qs;
qs = postgres_get_wire_fee (pg,
@@ -7645,8 +7647,12 @@ postgres_insert_wire_fee (void *cls,
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- if ( (sd.abs_value_us != start_date.abs_value_us) ||
- (ed.abs_value_us != end_date.abs_value_us) )
+ if ( (GNUNET_TIME_timestamp_cmp (sd,
+ !=,
+ start_date)) ||
+ (GNUNET_TIME_timestamp_cmp (ed,
+ !=,
+ end_date)) )
{
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -7708,13 +7714,13 @@ reserve_expired_cb (void *cls,
ret = GNUNET_OK;
for (unsigned int i = 0; i<num_results; i++)
{
- struct GNUNET_TIME_Absolute exp_date;
+ struct GNUNET_TIME_Timestamp exp_date;
char *account_details;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_Amount remaining_balance;
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("expiration_date",
- &exp_date),
+ GNUNET_PQ_result_spec_timestamp ("expiration_date",
+ &exp_date),
GNUNET_PQ_result_spec_string ("account_details",
&account_details),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
@@ -7758,13 +7764,13 @@ reserve_expired_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_get_expired_reserves (void *cls,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
TALER_EXCHANGEDB_ReserveExpiredCallback rec,
void *rec_cls)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- TALER_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_end
};
struct ExpiredReserveContext ectx;
@@ -7801,7 +7807,7 @@ static enum GNUNET_DB_QueryStatus
postgres_insert_reserve_closed (
void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const char *receiver_account,
const struct TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *amount_with_fee,
@@ -7824,7 +7830,7 @@ postgres_insert_reserve_closed (
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
- TALER_PQ_query_param_absolute_time (&execution_date),
+ GNUNET_PQ_query_param_timestamp (&execution_date),
GNUNET_PQ_query_param_auto_from_type (wtid),
GNUNET_PQ_query_param_uint64 (&kyc.payment_target_uuid),
TALER_PQ_query_param_amount (amount_with_fee),
@@ -8115,7 +8121,7 @@ postgres_start_deferred_wire_out (void *cls)
static enum GNUNET_DB_QueryStatus
postgres_store_wire_transfer_out (
void *cls,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
uint64_t wire_target,
const char *exchange_account_section,
@@ -8123,7 +8129,7 @@ postgres_store_wire_transfer_out (
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- TALER_PQ_query_param_absolute_time (&date),
+ GNUNET_PQ_query_param_timestamp (&date),
GNUNET_PQ_query_param_auto_from_type (wtid),
GNUNET_PQ_query_param_uint64 (&wire_target),
GNUNET_PQ_query_param_string (exchange_account_section),
@@ -8131,8 +8137,6 @@ postgres_store_wire_transfer_out (
GNUNET_PQ_query_param_end
};
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&date));
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_wire_out",
params);
@@ -8151,31 +8155,30 @@ static enum GNUNET_GenericReturnValue
postgres_gc (void *cls)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
struct GNUNET_TIME_Absolute long_ago;
struct GNUNET_PQ_QueryParam params_none[] = {
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_QueryParam params_time[] = {
- TALER_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_QueryParam params_ancient_time[] = {
- TALER_PQ_query_param_absolute_time (&long_ago),
+ GNUNET_PQ_query_param_absolute_time (&long_ago),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_Context *conn;
- int ret;
+ enum GNUNET_GenericReturnValue ret;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* Keep wire fees for 10 years, that should always
be enough _and_ they are tiny so it does not
matter to make this tight */
- long_ago = GNUNET_TIME_absolute_subtract (now,
- GNUNET_TIME_relative_multiply (
- GNUNET_TIME_UNIT_YEARS,
- 10));
+ long_ago = GNUNET_TIME_absolute_subtract (
+ now,
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_YEARS,
+ 10));
{
struct GNUNET_PQ_PreparedStatement ps[] = {
/* Used in #postgres_gc() */
@@ -8283,17 +8286,17 @@ deposit_serial_helper_cb (void *cls,
for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_Deposit deposit;
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
struct TALER_DenominationPublicKey denom_pub;
bool done;
uint64_t rowid;
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&deposit.amount_with_fee),
- TALER_PQ_result_spec_absolute_time ("wallet_timestamp",
- &deposit.timestamp),
- TALER_PQ_result_spec_absolute_time ("exchange_timestamp",
- &exchange_timestamp),
+ GNUNET_PQ_result_spec_timestamp ("wallet_timestamp",
+ &deposit.timestamp),
+ GNUNET_PQ_result_spec_timestamp ("exchange_timestamp",
+ &exchange_timestamp),
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
&deposit.merchant_pub),
TALER_PQ_result_spec_denom_pub ("denom_pub",
@@ -8302,10 +8305,10 @@ deposit_serial_helper_cb (void *cls,
&deposit.coin.coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&deposit.csig),
- TALER_PQ_result_spec_absolute_time ("refund_deadline",
- &deposit.refund_deadline),
- TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &deposit.wire_deadline),
+ GNUNET_PQ_result_spec_timestamp ("refund_deadline",
+ &deposit.refund_deadline),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ &deposit.wire_deadline),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
&deposit.h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("wire_salt",
@@ -8705,7 +8708,7 @@ reserves_in_serial_helper_cb (void *cls,
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_Amount credit;
char *sender_account_details;
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
uint64_t rowid;
uint64_t wire_reference;
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -8715,8 +8718,8 @@ reserves_in_serial_helper_cb (void *cls,
&wire_reference),
TALER_PQ_RESULT_SPEC_AMOUNT ("credit",
&credit),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &execution_date),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &execution_date),
GNUNET_PQ_result_spec_string ("sender_account_details",
&sender_account_details),
GNUNET_PQ_result_spec_uint64 ("reserve_in_serial_id",
@@ -8883,7 +8886,7 @@ reserves_out_serial_helper_cb (void *cls,
struct TALER_DenominationPublicKey denom_pub;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_ReserveSignatureP reserve_sig;
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
struct TALER_Amount amount_with_fee;
uint64_t rowid;
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -8895,8 +8898,8 @@ reserves_out_serial_helper_cb (void *cls,
&reserve_pub),
GNUNET_PQ_result_spec_auto_from_type ("reserve_sig",
&reserve_sig),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &execution_date),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &execution_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&amount_with_fee),
GNUNET_PQ_result_spec_uint64 ("reserve_out_serial_id",
@@ -9017,15 +9020,15 @@ wire_out_serial_helper_cb (void *cls,
for (unsigned int i = 0; i<num_results; i++)
{
uint64_t rowid;
- struct GNUNET_TIME_Absolute date;
+ struct GNUNET_TIME_Timestamp date;
struct TALER_WireTransferIdentifierRawP wtid;
char *payto_uri;
struct TALER_Amount amount;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("wireout_uuid",
&rowid),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &date),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &date),
GNUNET_PQ_result_spec_auto_from_type ("wtid_raw",
&wtid),
GNUNET_PQ_result_spec_string ("payto_uri",
@@ -9197,12 +9200,12 @@ recoup_serial_helper_cb (void *cls,
struct TALER_Amount amount;
struct TALER_DenominationPublicKey denom_pub;
struct TALER_BlindedCoinHash h_blind_ev;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("recoup_uuid",
&rowid),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@@ -9346,12 +9349,12 @@ recoup_refresh_serial_helper_cb (void *cls,
struct TALER_DenominationHash old_denom_pub_hash;
struct TALER_Amount amount;
struct TALER_BlindedCoinHash h_blind_ev;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("recoup_refresh_uuid",
&rowid),
- TALER_PQ_result_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_PQ_result_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub",
&old_coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("old_denom_pub_hash",
@@ -9495,14 +9498,14 @@ reserve_closed_serial_helper_cb (void *cls,
struct TALER_WireTransferIdentifierRawP wtid;
struct TALER_Amount amount_with_fee;
struct TALER_Amount closing_fee;
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("close_uuid",
&rowid),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &execution_date),
+ GNUNET_PQ_result_spec_timestamp ("execution_date",
+ &execution_date),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
&wtid),
GNUNET_PQ_result_spec_string ("receiver_account",
@@ -9605,18 +9608,18 @@ postgres_insert_recoup_request (
const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct TALER_BlindedCoinHash *h_blind_ev,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute expiry;
- struct GNUNET_TIME_Absolute gc;
+ struct GNUNET_TIME_Timestamp expiry;
+ struct GNUNET_TIME_Timestamp gc;
struct TALER_EXCHANGEDB_Reserve reserve;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&coin->coin_pub),
GNUNET_PQ_query_param_auto_from_type (coin_sig),
GNUNET_PQ_query_param_auto_from_type (coin_blind),
TALER_PQ_query_param_amount (amount),
- TALER_PQ_query_param_absolute_time (&timestamp),
+ GNUNET_PQ_query_param_timestamp (&timestamp),
GNUNET_PQ_query_param_auto_from_type (h_blind_ev),
GNUNET_PQ_query_param_end
};
@@ -9652,16 +9655,16 @@ postgres_insert_recoup_request (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Inserting recoup for coin %s\n",
TALER_B2S (&coin->coin_pub));
- gc = GNUNET_TIME_absolute_add (timestamp,
- pg->legal_reserve_expiration_time);
- reserve.gc = GNUNET_TIME_absolute_max (gc,
- reserve.gc);
- (void) GNUNET_TIME_round_abs (&reserve.gc);
- expiry = GNUNET_TIME_absolute_add (timestamp,
- pg->idle_reserve_expiration_time);
- reserve.expiry = GNUNET_TIME_absolute_max (expiry,
- reserve.expiry);
- (void) GNUNET_TIME_round_abs (&reserve.expiry);
+ gc = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (timestamp.abs_time,
+ pg->legal_reserve_expiration_time));
+ reserve.gc = GNUNET_TIME_timestamp_max (gc,
+ reserve.gc);
+ expiry = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (timestamp.abs_time,
+ pg->idle_reserve_expiration_time));
+ reserve.expiry = GNUNET_TIME_timestamp_max (expiry,
+ reserve.expiry);
qs = reserves_update (pg,
&reserve);
if (0 >= qs)
@@ -9697,7 +9700,7 @@ postgres_insert_recoup_refresh_request (
const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct TALER_BlindedCoinHash *h_blind_ev,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -9705,7 +9708,7 @@ postgres_insert_recoup_refresh_request (
GNUNET_PQ_query_param_auto_from_type (coin_sig),
GNUNET_PQ_query_param_auto_from_type (coin_blind),
TALER_PQ_query_param_amount (amount),
- TALER_PQ_query_param_absolute_time (&timestamp),
+ GNUNET_PQ_query_param_timestamp (&timestamp),
GNUNET_PQ_query_param_auto_from_type (h_blind_ev),
GNUNET_PQ_query_param_end
};
@@ -9903,7 +9906,7 @@ missing_wire_cb (void *cls,
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_Amount amount;
char *payto_uri;
- struct GNUNET_TIME_Absolute deadline;
+ struct GNUNET_TIME_Timestamp deadline;
bool tiny;
bool done;
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -9915,8 +9918,8 @@ missing_wire_cb (void *cls,
&amount),
GNUNET_PQ_result_spec_string ("payto_uri",
&payto_uri),
- TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &deadline),
+ GNUNET_PQ_result_spec_timestamp ("wire_deadline",
+ &deadline),
GNUNET_PQ_result_spec_bool ("tiny",
&tiny),
GNUNET_PQ_result_spec_bool ("done",
@@ -9960,15 +9963,15 @@ missing_wire_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_deposits_missing_wire (void *cls,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
TALER_EXCHANGEDB_WireMissingCallback cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- TALER_PQ_query_param_absolute_time (&start_date),
- TALER_PQ_query_param_absolute_time (&end_date),
+ GNUNET_PQ_query_param_timestamp (&start_date),
+ GNUNET_PQ_query_param_timestamp (&end_date),
GNUNET_PQ_query_param_end
};
struct MissingWireContext mwc = {
@@ -10002,7 +10005,7 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_auditor_timestamp (
void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute *last_date)
+ struct GNUNET_TIME_Timestamp *last_date)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -10010,8 +10013,8 @@ postgres_lookup_auditor_timestamp (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("last_change",
- last_date),
+ GNUNET_PQ_result_spec_timestamp ("last_change",
+ last_date),
GNUNET_PQ_result_spec_end
};
@@ -10075,14 +10078,14 @@ postgres_insert_auditor (void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute start_date)
+ struct GNUNET_TIME_Timestamp start_date)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (auditor_pub),
GNUNET_PQ_query_param_string (auditor_name),
GNUNET_PQ_query_param_string (auditor_url),
- GNUNET_PQ_query_param_absolute_time (&start_date),
+ GNUNET_PQ_query_param_timestamp (&start_date),
GNUNET_PQ_query_param_end
};
@@ -10109,7 +10112,7 @@ postgres_update_auditor (void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute change_date,
+ struct GNUNET_TIME_Timestamp change_date,
bool enabled)
{
struct PostgresClosure *pg = cls;
@@ -10118,7 +10121,7 @@ postgres_update_auditor (void *cls,
GNUNET_PQ_query_param_string (auditor_url),
GNUNET_PQ_query_param_string (auditor_name),
GNUNET_PQ_query_param_bool (enabled),
- GNUNET_PQ_query_param_absolute_time (&change_date),
+ GNUNET_PQ_query_param_timestamp (&change_date),
GNUNET_PQ_query_param_end
};
@@ -10139,7 +10142,7 @@ postgres_update_auditor (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_lookup_wire_timestamp (void *cls,
const char *payto_uri,
- struct GNUNET_TIME_Absolute *last_date)
+ struct GNUNET_TIME_Timestamp *last_date)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -10147,8 +10150,8 @@ postgres_lookup_wire_timestamp (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("last_change",
- last_date),
+ GNUNET_PQ_result_spec_timestamp ("last_change",
+ last_date),
GNUNET_PQ_result_spec_end
};
@@ -10173,14 +10176,14 @@ postgres_lookup_wire_timestamp (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_wire (void *cls,
const char *payto_uri,
- struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (payto_uri),
GNUNET_PQ_query_param_auto_from_type (master_sig),
- GNUNET_PQ_query_param_absolute_time (&start_date),
+ GNUNET_PQ_query_param_timestamp (&start_date),
GNUNET_PQ_query_param_end
};
@@ -10203,14 +10206,14 @@ postgres_insert_wire (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_update_wire (void *cls,
const char *payto_uri,
- struct GNUNET_TIME_Absolute change_date,
+ struct GNUNET_TIME_Timestamp change_date,
bool enabled)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (payto_uri),
GNUNET_PQ_query_param_bool (enabled),
- GNUNET_PQ_query_param_absolute_time (&change_date),
+ GNUNET_PQ_query_param_timestamp (&change_date),
GNUNET_PQ_query_param_end
};
@@ -10370,17 +10373,17 @@ get_wire_fees_cb (void *cls,
struct TALER_MasterSignatureP master_sig;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
&wire_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
&closing_fee),
- TALER_PQ_result_spec_absolute_time ("start_date",
- &start_date),
- TALER_PQ_result_spec_absolute_time ("end_date",
- &end_date),
+ GNUNET_PQ_result_spec_timestamp ("start_date",
+ &start_date),
+ GNUNET_PQ_result_spec_timestamp ("end_date",
+ &end_date),
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&master_sig),
GNUNET_PQ_result_spec_end
@@ -10525,14 +10528,14 @@ postgres_lookup_denomination_key (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("valid_from",
- &meta->start),
- TALER_PQ_result_spec_absolute_time ("expire_withdraw",
- &meta->expire_withdraw),
- TALER_PQ_result_spec_absolute_time ("expire_deposit",
- &meta->expire_deposit),
- TALER_PQ_result_spec_absolute_time ("expire_legal",
- &meta->expire_legal),
+ GNUNET_PQ_result_spec_timestamp ("valid_from",
+ &meta->start),
+ GNUNET_PQ_result_spec_timestamp ("expire_withdraw",
+ &meta->expire_withdraw),
+ GNUNET_PQ_result_spec_timestamp ("expire_deposit",
+ &meta->expire_deposit),
+ GNUNET_PQ_result_spec_timestamp ("expire_legal",
+ &meta->expire_legal),
TALER_PQ_RESULT_SPEC_AMOUNT ("coin",
&meta->value),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_withdraw",
@@ -10577,10 +10580,10 @@ postgres_add_denomination_key (
GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
TALER_PQ_query_param_denom_pub (denom_pub),
GNUNET_PQ_query_param_auto_from_type (master_sig),
- TALER_PQ_query_param_absolute_time (&meta->start),
- TALER_PQ_query_param_absolute_time (&meta->expire_withdraw),
- TALER_PQ_query_param_absolute_time (&meta->expire_deposit),
- TALER_PQ_query_param_absolute_time (&meta->expire_legal),
+ GNUNET_PQ_query_param_timestamp (&meta->start),
+ GNUNET_PQ_query_param_timestamp (&meta->expire_withdraw),
+ GNUNET_PQ_query_param_timestamp (&meta->expire_deposit),
+ GNUNET_PQ_query_param_timestamp (&meta->expire_legal),
TALER_PQ_query_param_amount (&meta->value),
TALER_PQ_query_param_amount (&meta->fee_withdraw),
TALER_PQ_query_param_amount (&meta->fee_deposit),
@@ -10627,9 +10630,9 @@ postgres_activate_signing_key (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam iparams[] = {
GNUNET_PQ_query_param_auto_from_type (exchange_pub),
- TALER_PQ_query_param_absolute_time (&meta->start),
- TALER_PQ_query_param_absolute_time (&meta->expire_sign),
- TALER_PQ_query_param_absolute_time (&meta->expire_legal),
+ GNUNET_PQ_query_param_timestamp (&meta->start),
+ GNUNET_PQ_query_param_timestamp (&meta->expire_sign),
+ GNUNET_PQ_query_param_timestamp (&meta->expire_legal),
GNUNET_PQ_query_param_auto_from_type (master_sig),
GNUNET_PQ_query_param_end
};
@@ -10660,12 +10663,12 @@ postgres_lookup_signing_key (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("valid_from",
- &meta->start),
- TALER_PQ_result_spec_absolute_time ("expire_sign",
- &meta->expire_sign),
- TALER_PQ_result_spec_absolute_time ("expire_legal",
- &meta->expire_legal),
+ GNUNET_PQ_result_spec_timestamp ("valid_from",
+ &meta->start),
+ GNUNET_PQ_result_spec_timestamp ("expire_sign",
+ &meta->expire_sign),
+ GNUNET_PQ_result_spec_timestamp ("expire_legal",
+ &meta->expire_legal),
GNUNET_PQ_result_spec_end
};
@@ -10864,16 +10867,16 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_wire_fee_by_time (
void *cls,
const char *wire_method,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
struct TALER_Amount *wire_fee,
struct TALER_Amount *closing_fee)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (wire_method),
- GNUNET_PQ_query_param_absolute_time (&start_time),
- GNUNET_PQ_query_param_absolute_time (&end_time),
+ GNUNET_PQ_query_param_timestamp (&start_time),
+ GNUNET_PQ_query_param_timestamp (&end_time),
GNUNET_PQ_query_param_end
};
struct WireFeeLookupContext wlc = {
@@ -11338,16 +11341,16 @@ postgres_begin_shard (void *cls,
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (job_name),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_uint64 (start_row),
GNUNET_PQ_query_param_uint64 (end_row),
GNUNET_PQ_query_param_end
};
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"reclaim_shard",
params);
@@ -11412,16 +11415,16 @@ postgres_begin_shard (void *cls,
/* Claim fresh shard */
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (job_name),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_uint64 (start_row),
GNUNET_PQ_query_param_uint64 (end_row),
GNUNET_PQ_query_param_end
};
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to claim shard %llu-%llu\n",
(unsigned long long) *start_row,
@@ -11583,10 +11586,10 @@ postgres_begin_revolving_shard (void *cls,
{
/* Claim fresh shard */
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (job_name),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_uint32 (start_row),
GNUNET_PQ_query_param_uint32 (end_row),
GNUNET_PQ_query_param_end
@@ -11594,7 +11597,7 @@ postgres_begin_revolving_shard (void *cls,
*end_row = GNUNET_MIN (shard_limit,
*start_row + shard_size - 1);
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to claim shard %llu-%llu\n",
(unsigned long long) *start_row,
@@ -11657,15 +11660,16 @@ postgres_begin_revolving_shard (void *cls,
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (job_name),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_uint32 (start_row),
GNUNET_PQ_query_param_uint32 (end_row),
GNUNET_PQ_query_param_end
};
+ now = GNUNET_TIME_timestamp_get ();
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"reclaim_revolving_shard",
params);
diff --git a/src/include/taler_auditor_service.h b/src/include/taler_auditor_service.h
index bc990a143..f71520345 100644
--- a/src/include/taler_auditor_service.h
+++ b/src/include/taler_auditor_service.h
@@ -259,18 +259,18 @@ TALER_AUDITOR_deposit_confirmation (
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute ep_start,
- struct GNUNET_TIME_Absolute ep_expire,
- struct GNUNET_TIME_Absolute ep_end,
+ struct GNUNET_TIME_Timestamp ep_start,
+ struct GNUNET_TIME_Timestamp ep_expire,
+ struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_AUDITOR_DepositConfirmationResultCallback cb,
void *cb_cls);
diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h
index 7756db2bc..e4ff8e8e2 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -63,7 +63,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_AUDITORDB_HistoricDenominationRevenueDataCallback)(
void *cls,
const struct TALER_DenominationHash *denom_pub_hash,
- struct GNUNET_TIME_Absolute revenue_timestamp,
+ struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *loss_balance);
@@ -84,8 +84,8 @@ typedef enum GNUNET_GenericReturnValue
typedef enum GNUNET_GenericReturnValue
(*TALER_AUDITORDB_HistoricReserveRevenueDataCallback)(
void *cls,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *reserve_profits);
@@ -100,7 +100,7 @@ struct TALER_AUDITORDB_WireProgressPoint
* Time until which we have confirmed that all wire transactions
* that the exchange should do, have indeed been done.
*/
- struct GNUNET_TIME_Absolute last_timestamp;
+ struct GNUNET_TIME_Timestamp last_timestamp;
/**
* reserves_close uuid until which we have checked
@@ -240,17 +240,17 @@ struct TALER_AUDITORDB_ExchangeSigningKey
/**
* When does @e exchange_pub start to be used?
*/
- struct GNUNET_TIME_Absolute ep_start;
+ struct GNUNET_TIME_Timestamp ep_start;
/**
* When will the exchange stop signing with @e exchange_pub?
*/
- struct GNUNET_TIME_Absolute ep_expire;
+ struct GNUNET_TIME_Timestamp ep_expire;
/**
* When does the signing key expire (for legal disputes)?
*/
- struct GNUNET_TIME_Absolute ep_end;
+ struct GNUNET_TIME_Timestamp ep_end;
/**
* What is the public offline signing key this is all about?
@@ -289,7 +289,7 @@ struct TALER_AUDITORDB_DepositConfirmation
/**
* Time when this deposit confirmation was generated by the exchange.
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* How much time does the @e merchant have to issue a refund
@@ -298,12 +298,12 @@ struct TALER_AUDITORDB_DepositConfirmation
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* How much time does the @e exchange have to wire the funds?
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@@ -872,7 +872,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
- struct GNUNET_TIME_Absolute expiration_date,
+ struct GNUNET_TIME_Timestamp expiration_date,
const char *origin_account);
@@ -895,7 +895,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
- struct GNUNET_TIME_Absolute expiration_date);
+ struct GNUNET_TIME_Timestamp expiration_date);
/**
@@ -919,7 +919,7 @@ struct TALER_AUDITORDB_Plugin
uint64_t *rowid,
struct TALER_Amount *reserve_balance,
struct TALER_Amount *withdraw_fee_balance,
- struct GNUNET_TIME_Absolute *expiration_date,
+ struct GNUNET_TIME_Timestamp *expiration_date,
char **sender_account);
@@ -1220,7 +1220,7 @@ struct TALER_AUDITORDB_Plugin
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_DenominationHash *denom_pub_hash,
- struct GNUNET_TIME_Absolute revenue_timestamp,
+ struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *recoup_loss_balance);
@@ -1257,8 +1257,8 @@ struct TALER_AUDITORDB_Plugin
(*insert_historic_reserve_revenue)(
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *reserve_profits);
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index db78ca6a8..bb7f3d33b 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -112,12 +112,13 @@ struct TALER_BANK_AdminAddIncomingHandle;
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON
*/
typedef void
-(*TALER_BANK_AdminAddIncomingCallback) (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- uint64_t serial_id,
- struct GNUNET_TIME_Absolute timestamp,
- const json_t *json);
+(*TALER_BANK_AdminAddIncomingCallback) (
+ void *cls,
+ unsigned int http_status,
+ enum TALER_ErrorCode ec,
+ uint64_t serial_id,
+ struct GNUNET_TIME_Timestamp timestamp,
+ const json_t *json);
/**
@@ -199,11 +200,12 @@ struct TALER_BANK_TransferHandle;
* @param timestamp when did the transaction go into effect
*/
typedef void
-(*TALER_BANK_TransferCallback)(void *cls,
- unsigned int response_code,
- enum TALER_ErrorCode ec,
- uint64_t row_id,
- struct GNUNET_TIME_Absolute timestamp);
+(*TALER_BANK_TransferCallback)(
+ void *cls,
+ unsigned int response_code,
+ enum TALER_ErrorCode ec,
+ uint64_t row_id,
+ struct GNUNET_TIME_Timestamp timestamp);
/**
@@ -266,7 +268,7 @@ struct TALER_BANK_CreditDetails
/**
* Time of the the transfer
*/
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
/**
* Reserve public key encoded in the wire
@@ -332,13 +334,14 @@ typedef enum GNUNET_GenericReturnValue
* In this case, the callback is not called.
*/
struct TALER_BANK_CreditHistoryHandle *
-TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
- const struct TALER_BANK_AuthenticationData *auth,
- uint64_t start_row,
- int64_t num_results,
- struct GNUNET_TIME_Relative timeout,
- TALER_BANK_CreditHistoryCallback hres_cb,
- void *hres_cb_cls);
+TALER_BANK_credit_history (
+ struct GNUNET_CURL_Context *ctx,
+ const struct TALER_BANK_AuthenticationData *auth,
+ uint64_t start_row,
+ int64_t num_results,
+ struct GNUNET_TIME_Relative timeout,
+ TALER_BANK_CreditHistoryCallback hres_cb,
+ void *hres_cb_cls);
/**
@@ -374,7 +377,7 @@ struct TALER_BANK_DebitDetails
/**
* Time of the the transfer
*/
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
/**
* Wire transfer identifier used by the exchange.
@@ -477,7 +480,7 @@ TALER_BANK_debit_history_cancel (struct TALER_BANK_DebitHistoryHandle *hh);
* @param[out] auth set to the configuration data found
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section,
struct TALER_BANK_AuthenticationData *auth);
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index ea53efb66..0a59ab9e3 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1367,7 +1367,7 @@ typedef void
(*TALER_CRYPTO_RsaDenominationKeyStatusCallback)(
void *cls,
const char *section_name,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_RsaPubHashP *h_rsa,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -1484,7 +1484,7 @@ struct TALER_CRYPTO_ExchangeSignHelper;
typedef void
(*TALER_CRYPTO_ExchangeKeyStatusCallback)(
void *cls,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_SecurityModulePublicKeyP *sm_pub,
@@ -1625,9 +1625,9 @@ TALER_exchange_deposit_confirm_verify (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@@ -1661,9 +1661,9 @@ TALER_wallet_deposit_sign (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute wallet_timestamp,
+ struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig);
@@ -1692,9 +1692,9 @@ TALER_wallet_deposit_verify (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute wallet_timestamp,
+ struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig);
@@ -1754,7 +1754,7 @@ void
TALER_exchange_offline_auditor_add_sign (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
- struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@@ -1773,7 +1773,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_offline_auditor_add_verify (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
- struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@@ -1789,7 +1789,7 @@ TALER_exchange_offline_auditor_add_verify (
void
TALER_exchange_offline_auditor_del_sign (
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@@ -1806,7 +1806,7 @@ TALER_exchange_offline_auditor_del_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_auditor_del_verify (
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@@ -1882,9 +1882,9 @@ TALER_exchange_offline_signkey_revoke_verify (
void
TALER_exchange_offline_signkey_validity_sign (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
- struct GNUNET_TIME_Absolute end_sign,
- struct GNUNET_TIME_Absolute end_legal,
+ struct GNUNET_TIME_Timestamp start_sign,
+ struct GNUNET_TIME_Timestamp end_sign,
+ struct GNUNET_TIME_Timestamp end_legal,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@@ -1903,9 +1903,9 @@ TALER_exchange_offline_signkey_validity_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_signkey_validity_verify (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
- struct GNUNET_TIME_Absolute end_sign,
- struct GNUNET_TIME_Absolute end_legal,
+ struct GNUNET_TIME_Timestamp start_sign,
+ struct GNUNET_TIME_Timestamp end_sign,
+ struct GNUNET_TIME_Timestamp end_legal,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@@ -1929,10 +1929,10 @@ TALER_exchange_offline_signkey_validity_verify (
void
TALER_exchange_offline_denom_validity_sign (
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -1962,10 +1962,10 @@ TALER_exchange_offline_denom_validity_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_denom_validity_verify (
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -1987,7 +1987,7 @@ TALER_exchange_offline_denom_validity_verify (
void
TALER_exchange_secmod_eddsa_sign (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePrivateKeyP *secm_priv,
struct TALER_SecurityModuleSignatureP *secm_sig);
@@ -2006,7 +2006,7 @@ TALER_exchange_secmod_eddsa_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_secmod_eddsa_verify (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePublicKeyP *secm_pub,
const struct TALER_SecurityModuleSignatureP *secm_sig);
@@ -2026,7 +2026,7 @@ void
TALER_exchange_secmod_rsa_sign (
const struct TALER_RsaPubHashP *h_rsa,
const char *section_name,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePrivateKeyP *secm_priv,
struct TALER_SecurityModuleSignatureP *secm_sig);
@@ -2047,7 +2047,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_secmod_rsa_verify (
const struct TALER_RsaPubHashP *h_rsa,
const char *section_name,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePublicKeyP *secm_pub,
const struct TALER_SecurityModuleSignatureP *secm_sig);
@@ -2076,10 +2076,10 @@ TALER_auditor_denom_validity_sign (
const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -2113,10 +2113,10 @@ TALER_auditor_denom_validity_verify (
const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -2143,8 +2143,8 @@ TALER_auditor_denom_validity_verify (
void
TALER_exchange_offline_wire_fee_sign (
const char *payment_method,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterPrivateKeyP *master_priv,
@@ -2166,8 +2166,8 @@ TALER_exchange_offline_wire_fee_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_fee_verify (
const char *payment_method,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterPublicKeyP *master_pub,
@@ -2185,7 +2185,7 @@ TALER_exchange_offline_wire_fee_verify (
void
TALER_exchange_offline_wire_add_sign (
const char *payto_uri,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@@ -2202,7 +2202,7 @@ TALER_exchange_offline_wire_add_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_add_verify (
const char *payto_uri,
- struct GNUNET_TIME_Absolute sign_time,
+ struct GNUNET_TIME_Timestamp sign_time,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@@ -2218,7 +2218,7 @@ TALER_exchange_offline_wire_add_verify (
void
TALER_exchange_offline_wire_del_sign (
const char *payto_uri,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@@ -2235,7 +2235,7 @@ TALER_exchange_offline_wire_del_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_del_verify (
const char *payto_uri,
- struct GNUNET_TIME_Absolute sign_time,
+ struct GNUNET_TIME_Timestamp sign_time,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 09c50b17e..60a471ab6 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -70,17 +70,17 @@ struct TALER_EXCHANGE_SigningPublicKey
/**
* Validity start time
*/
- struct GNUNET_TIME_Absolute valid_from;
+ struct GNUNET_TIME_Timestamp valid_from;
/**
* Validity expiration time (how long the exchange may use it).
*/
- struct GNUNET_TIME_Absolute valid_until;
+ struct GNUNET_TIME_Timestamp valid_until;
/**
* Validity expiration time for legal disputes.
*/
- struct GNUNET_TIME_Absolute valid_legal;
+ struct GNUNET_TIME_Timestamp valid_legal;
};
@@ -107,18 +107,18 @@ struct TALER_EXCHANGE_DenomPublicKey
/**
* Timestamp indicating when the denomination key becomes valid
*/
- struct GNUNET_TIME_Absolute valid_from;
+ struct GNUNET_TIME_Timestamp valid_from;
/**
* Timestamp indicating when the denomination key can’t be used anymore to
* withdraw new coins.
*/
- struct GNUNET_TIME_Absolute withdraw_valid_until;
+ struct GNUNET_TIME_Timestamp withdraw_valid_until;
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
- struct GNUNET_TIME_Absolute expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@@ -127,7 +127,7 @@ struct TALER_EXCHANGE_DenomPublicKey
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
- struct GNUNET_TIME_Absolute expire_legal;
+ struct GNUNET_TIME_Timestamp expire_legal;
/**
* The value of this denomination
@@ -273,14 +273,14 @@ struct TALER_EXCHANGE_Keys
/**
* Timestamp indicating the /keys generation.
*/
- struct GNUNET_TIME_Absolute list_issue_date;
+ struct GNUNET_TIME_Timestamp list_issue_date;
/**
* Timestamp indicating the creation time of the last
* denomination key in /keys.
* Used to fetch /keys incrementally.
*/
- struct GNUNET_TIME_Absolute last_denom_issue_date;
+ struct GNUNET_TIME_Timestamp last_denom_issue_date;
/**
* Length of the @e sign_keys array (number of valid entries).
@@ -491,7 +491,7 @@ TALER_EXCHANGE_get_keys (struct TALER_EXCHANGE_Handle *exchange);
*/
void
TALER_EXCHANGE_set_last_denom (struct TALER_EXCHANGE_Handle *exchange,
- struct GNUNET_TIME_Absolute last_denom_new);
+ struct GNUNET_TIME_Timestamp last_denom_new);
/**
@@ -535,7 +535,7 @@ enum TALER_EXCHANGE_CheckKeysFlags
* @param flags options controlling when to download what
* @return until when the existing response is current, 0 if we are re-downloading now
*/
-struct GNUNET_TIME_Absolute
+struct GNUNET_TIME_Timestamp
TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
enum TALER_EXCHANGE_CheckKeysFlags flags);
@@ -663,12 +663,12 @@ struct TALER_EXCHANGE_WireAggregateFees
/**
* Time when this fee goes into effect (inclusive)
*/
- struct GNUNET_TIME_Absolute start_date;
+ struct GNUNET_TIME_Timestamp start_date;
/**
* Time when this fee stops being in effect (exclusive).
*/
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp end_date;
/**
* Signature affirming the above fee structure.
@@ -789,9 +789,9 @@ TALER_EXCHANGE_deposit_permission_sign (
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
- struct GNUNET_TIME_Absolute wallet_timestamp,
+ struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
struct TALER_CoinSpendSignatureP *coin_sig);
@@ -824,7 +824,7 @@ struct TALER_EXCHANGE_DepositResult
/**
* Time when the exchange generated the deposit confirmation
*/
- struct GNUNET_TIME_Absolute deposit_timestamp;
+ struct GNUNET_TIME_Timestamp deposit_timestamp;
/**
* signature provided by the exchange
@@ -910,7 +910,7 @@ struct TALER_EXCHANGE_DepositHandle *
TALER_EXCHANGE_deposit (
struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- struct GNUNET_TIME_Absolute wire_deadline,
+ struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri,
const struct TALER_WireSalt *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms,
@@ -918,9 +918,9 @@ TALER_EXCHANGE_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig,
TALER_EXCHANGE_DepositResultCallback cb,
void *cb_cls,
@@ -1102,7 +1102,7 @@ struct TALER_EXCHANGE_ReserveHistory
/**
* When did the wire transfer happen?
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
} in_details;
@@ -1149,7 +1149,7 @@ struct TALER_EXCHANGE_ReserveHistory
/**
* When did the /recoup operation happen?
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
} recoup_details;
@@ -1183,7 +1183,7 @@ struct TALER_EXCHANGE_ReserveHistory
/**
* When did the wire transfer happen?
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Fee that was charged for the closing.
@@ -1716,7 +1716,7 @@ struct TALER_EXCHANGE_TransferData
/**
* time when the exchange claims to have performed the wire transfer
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Actual amount of the wire transfer, excluding the wire fee.
@@ -1837,7 +1837,7 @@ struct TALER_EXCHANGE_GetDepositResponse
/**
* actual execution time for the wire transfer
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* contribution to the total amount by this coin, all zeros if exchange did not
@@ -1861,7 +1861,7 @@ struct TALER_EXCHANGE_GetDepositResponse
/**
* planned execution time for the wire transfer
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Payment target that the merchant should use
@@ -2029,6 +2029,7 @@ typedef void
* @param pk kind of coin to pay back
* @param denom_sig signature over the coin by the exchange using @a pk
* @param ps secret internals of the original planchet
+ * @param amount value remaining on the coin that is being recouped
* @param was_refreshed true if the coin in @a ps was refreshed
* @param recoup_cb the callback to call when the final result for this request is available
* @param recoup_cb_cls closure for @a recoup_cb
@@ -2041,6 +2042,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_Amount *amount,
bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls);
@@ -2091,7 +2093,7 @@ struct TALER_EXCHANGE_KycStatus
/**
* Time of the affirmation.
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* The signing public key used for @e exchange_sig.
@@ -2327,17 +2329,17 @@ struct TALER_EXCHANGE_FutureSigningPublicKey
/**
* Validity start time
*/
- struct GNUNET_TIME_Absolute valid_from;
+ struct GNUNET_TIME_Timestamp valid_from;
/**
* Validity expiration time (how long the exchange may use it).
*/
- struct GNUNET_TIME_Absolute valid_until;
+ struct GNUNET_TIME_Timestamp valid_until;
/**
* Validity expiration time for legal disputes.
*/
- struct GNUNET_TIME_Absolute valid_legal;
+ struct GNUNET_TIME_Timestamp valid_legal;
};
@@ -2359,18 +2361,18 @@ struct TALER_EXCHANGE_FutureDenomPublicKey
/**
* Timestamp indicating when the denomination key becomes valid
*/
- struct GNUNET_TIME_Absolute valid_from;
+ struct GNUNET_TIME_Timestamp valid_from;
/**
* Timestamp indicating when the denomination key can’t be used anymore to
* withdraw new coins.
*/
- struct GNUNET_TIME_Absolute withdraw_valid_until;
+ struct GNUNET_TIME_Timestamp withdraw_valid_until;
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
- struct GNUNET_TIME_Absolute expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@@ -2379,7 +2381,7 @@ struct TALER_EXCHANGE_FutureDenomPublicKey
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
- struct GNUNET_TIME_Absolute expire_legal;
+ struct GNUNET_TIME_Timestamp expire_legal;
/**
* The value of this denomination
@@ -2750,7 +2752,7 @@ TALER_EXCHANGE_management_enable_auditor (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute validity_start,
+ struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
void *cb_cls);
@@ -2801,7 +2803,7 @@ TALER_EXCHANGE_management_disable_auditor (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
void *cb_cls);
@@ -2855,7 +2857,7 @@ TALER_EXCHANGE_management_enable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
- struct GNUNET_TIME_Absolute validity_start,
+ struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig1,
const struct TALER_MasterSignatureP *master_sig2,
TALER_EXCHANGE_ManagementWireEnableCallback cb,
@@ -2908,7 +2910,7 @@ TALER_EXCHANGE_management_disable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementWireDisableCallback cb,
void *cb_cls);
@@ -2963,8 +2965,8 @@ TALER_EXCHANGE_management_set_wire_fees (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
const char *wire_method,
- struct GNUNET_TIME_Absolute validity_start,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_start,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig,
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 56a16dd72..ad840fc92 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -117,12 +117,12 @@ struct TALER_EXCHANGEDB_SignkeyMetaData
/**
* Start time of the validity period for this key.
*/
- struct GNUNET_TIME_Absolute start;
+ struct GNUNET_TIME_Timestamp start;
/**
* The exchange will sign messages with this key between @e start and this time.
*/
- struct GNUNET_TIME_Absolute expire_sign;
+ struct GNUNET_TIME_Timestamp expire_sign;
/**
* When do signatures with this sign key become invalid?
@@ -131,7 +131,7 @@ struct TALER_EXCHANGEDB_SignkeyMetaData
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_sign (by a year or more).
*/
- struct GNUNET_TIME_Absolute expire_legal;
+ struct GNUNET_TIME_Timestamp expire_legal;
};
@@ -197,10 +197,10 @@ struct TALER_EXCHANGEDB_TableData
uint32_t age_restrictions;
struct TALER_DenominationPublicKey denom_pub;
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute valid_from;
- struct GNUNET_TIME_Absolute expire_withdraw;
- struct GNUNET_TIME_Absolute expire_deposit;
- struct GNUNET_TIME_Absolute expire_legal;
+ struct GNUNET_TIME_Timestamp valid_from;
+ struct GNUNET_TIME_Timestamp expire_withdraw;
+ struct GNUNET_TIME_Timestamp expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_legal;
struct TALER_Amount coin;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@@ -228,8 +228,8 @@ struct TALER_EXCHANGEDB_TableData
* Note: not useful for auditor, because not UPDATEd!
*/
struct TALER_Amount current_balance;
- struct GNUNET_TIME_Absolute expiration_date;
- struct GNUNET_TIME_Absolute gc_date;
+ struct GNUNET_TIME_Timestamp expiration_date;
+ struct GNUNET_TIME_Timestamp gc_date;
} reserves;
struct
@@ -238,14 +238,14 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_Amount credit;
uint64_t sender_account;
char *exchange_account_section;
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
uint64_t reserve_uuid;
} reserves_in;
struct
{
uint64_t reserve_uuid;
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
struct TALER_WireTransferIdentifierRawP wtid;
uint64_t wire_target_serial_id;
struct TALER_Amount amount;
@@ -259,7 +259,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_BlindedDenominationSignature denom_sig;
uint64_t reserve_uuid;
struct TALER_ReserveSignatureP reserve_sig;
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
struct TALER_Amount amount_with_fee;
} reserves_out;
@@ -269,7 +269,7 @@ struct TALER_EXCHANGEDB_TableData
char *auditor_url;
char *auditor_name;
bool is_active;
- struct GNUNET_TIME_Absolute last_change;
+ struct GNUNET_TIME_Timestamp last_change;
} auditors;
struct
@@ -333,10 +333,10 @@ struct TALER_EXCHANGEDB_TableData
uint64_t shard;
uint64_t known_coin_id;
struct TALER_Amount amount_with_fee;
- struct GNUNET_TIME_Absolute wallet_timestamp;
- struct GNUNET_TIME_Absolute exchange_timestamp;
- struct GNUNET_TIME_Absolute refund_deadline;
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
+ struct GNUNET_TIME_Timestamp refund_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_PrivateContractHash h_contract_terms;
struct TALER_CoinSpendSignatureP coin_sig;
@@ -358,7 +358,7 @@ struct TALER_EXCHANGEDB_TableData
struct
{
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
struct TALER_WireTransferIdentifierRawP wtid_raw;
uint64_t wire_target_serial_id;
char *exchange_account_section;
@@ -374,8 +374,8 @@ struct TALER_EXCHANGEDB_TableData
struct
{
char *wire_method;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
struct TALER_MasterSignatureP master_sig;
@@ -387,7 +387,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_CoinSpendSignatureP coin_sig;
union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_Amount amount;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
uint64_t reserve_out_serial_id;
} recoup;
@@ -397,7 +397,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_CoinSpendSignatureP coin_sig;
union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_Amount amount;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
uint64_t rrc_serial;
} recoup_refresh;
@@ -467,7 +467,7 @@ struct TALER_EXCHANGEDB_BankTransfer
* (This is the execution date of the exchange's database,
* the execution date of the bank should be in @e wire).
*/
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
/**
* Detailed wire information about the sending account
@@ -508,7 +508,7 @@ struct TALER_EXCHANGEDB_ClosingTransfer
/**
* When did the exchange execute the transaction?
*/
- struct GNUNET_TIME_Absolute execution_date;
+ struct GNUNET_TIME_Timestamp execution_date;
/**
* Detailed wire information about the receiving account
@@ -544,13 +544,13 @@ struct TALER_EXCHANGEDB_Reserve
* The expiration date of this reserve; funds will be wired back
* at this time.
*/
- struct GNUNET_TIME_Absolute expiry;
+ struct GNUNET_TIME_Timestamp expiry;
/**
* The legal expiration date of this reserve; we will forget about
* it at this time.
*/
- struct GNUNET_TIME_Absolute gc;
+ struct GNUNET_TIME_Timestamp gc;
};
@@ -562,7 +562,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
/**
* Start time of the validity period for this key.
*/
- struct GNUNET_TIME_Absolute start;
+ struct GNUNET_TIME_Timestamp start;
/**
* The exchange will sign fresh coins between @e start and this time.
@@ -576,7 +576,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
* with the same value with overlapping validity periods, to address
* issues such as clock skew.
*/
- struct GNUNET_TIME_Absolute expire_withdraw;
+ struct GNUNET_TIME_Timestamp expire_withdraw;
/**
* Coins signed with the denomination key must be spent or refreshed
@@ -588,7 +588,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
* significantly larger than @e expire_withdraw (by months or even
* years).
*/
- struct GNUNET_TIME_Absolute expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@@ -597,7 +597,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
- struct GNUNET_TIME_Absolute expire_legal;
+ struct GNUNET_TIME_Timestamp expire_legal;
/**
* The value of the coins signed with this denomination key.
@@ -815,7 +815,7 @@ struct TALER_EXCHANGEDB_Recoup
/**
* When did the recoup operation happen?
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
};
@@ -857,7 +857,7 @@ struct TALER_EXCHANGEDB_RecoupListEntry
/**
* When did the /recoup operation happen?
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
};
@@ -900,7 +900,7 @@ struct TALER_EXCHANGEDB_RecoupRefreshListEntry
/**
* When did the recoup operation happen?
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
};
@@ -1054,14 +1054,14 @@ struct TALER_EXCHANGEDB_Deposit
* deposit request in a timely fashion (so back-dating is not
* prevented).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* How much time does the merchant have to issue a refund request?
* Zero if refunds are not allowed. After this time, the coin
* cannot be refunded.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* How much time does the merchant have to execute the wire transfer?
@@ -1069,7 +1069,7 @@ struct TALER_EXCHANGEDB_Deposit
* constraint (as the merchant can theoretically pick any time,
* including one in the past).
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Fraction of the coin's remaining value to be deposited, including
@@ -1141,14 +1141,14 @@ struct TALER_EXCHANGEDB_DepositListEntry
* deposit request in a timely fashion (so back-dating is not
* prevented).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* How much time does the merchant have to issue a refund request?
* Zero if refunds are not allowed. After this time, the coin
* cannot be refunded.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* How much time does the merchant have to execute the wire transfer?
@@ -1156,7 +1156,7 @@ struct TALER_EXCHANGEDB_DepositListEntry
* constraint (as the merchant can theoretically pick any time,
* including one in the past).
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Fraction of the coin's remaining value to be deposited, including
@@ -1572,7 +1572,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_DepositCallback)(
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit,
const struct TALER_DenominationPublicKey *denom_pub,
bool done);
@@ -1787,7 +1787,7 @@ typedef enum GNUNET_GenericReturnValue
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
- struct GNUNET_TIME_Absolute execution_date);
+ struct GNUNET_TIME_Timestamp execution_date);
/**
@@ -1821,8 +1821,8 @@ typedef void
void *cls,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterSignatureP *master_sig);
@@ -1847,7 +1847,7 @@ typedef enum GNUNET_GenericReturnValue
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee);
@@ -1888,7 +1888,7 @@ typedef void
uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri,
- struct GNUNET_TIME_Absolute exec_time,
+ struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@@ -1912,7 +1912,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_WireTransferOutCallback)(
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount);
@@ -1956,7 +1956,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_RecoupCallback)(
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@@ -1985,7 +1985,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_RecoupRefreshCallback)(
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_DenominationHash *old_denom_pub_hash,
@@ -2013,7 +2013,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_ReserveClosedCallback)(
void *cls,
uint64_t rowid,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
@@ -2049,7 +2049,7 @@ typedef enum GNUNET_DB_QueryStatus
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *left,
const char *account_details,
- struct GNUNET_TIME_Absolute expiration_date);
+ struct GNUNET_TIME_Timestamp expiration_date);
/**
@@ -2095,7 +2095,7 @@ typedef void
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount,
const char *payto_uri,
- struct GNUNET_TIME_Absolute deadline,
+ struct GNUNET_TIME_Timestamp deadline,
bool tiny,
bool done);
@@ -2462,7 +2462,7 @@ struct TALER_EXCHANGEDB_Plugin
(*reserves_in_insert)(void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *balance,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const char *sender_account_details,
const char *exchange_account_name,
uint64_t wire_reference);
@@ -2544,7 +2544,7 @@ struct TALER_EXCHANGEDB_Plugin
(*do_withdraw)(
void *cls,
const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
bool *found,
bool *balance_ok,
struct TALER_EXCHANGEDB_KycStatus *kyc_ok,
@@ -2712,7 +2712,7 @@ struct TALER_EXCHANGEDB_Plugin
(*have_deposit)(void *cls,
const struct TALER_EXCHANGEDB_Deposit *deposit,
struct TALER_Amount *deposit_fee,
- struct GNUNET_TIME_Absolute *exchange_timestamp);
+ struct GNUNET_TIME_Timestamp *exchange_timestamp);
/**
@@ -2737,9 +2737,9 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
struct TALER_Amount *deposit_fee,
- struct GNUNET_TIME_Absolute *exchange_timestamp);
+ struct GNUNET_TIME_Timestamp *exchange_timestamp);
/**
@@ -2752,7 +2752,7 @@ struct TALER_EXCHANGEDB_Plugin
*/
enum GNUNET_DB_QueryStatus
(*insert_deposit)(void *cls,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit);
@@ -3055,7 +3055,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_MerchantPublicKeyP *merchant_pub,
bool *pending,
struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute *exec_time,
+ struct GNUNET_TIME_Timestamp *exec_time,
struct TALER_Amount *amount_with_fee,
struct TALER_Amount *deposit_fee,
struct TALER_EXCHANGEDB_KycStatus *kyc);
@@ -3091,8 +3091,8 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_wire_fee)(void *cls,
const char *wire_method,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig);
@@ -3114,9 +3114,9 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*get_wire_fee)(void *cls,
const char *type,
- struct GNUNET_TIME_Absolute date,
- struct GNUNET_TIME_Absolute *start_date,
- struct GNUNET_TIME_Absolute *end_date,
+ struct GNUNET_TIME_Timestamp date,
+ struct GNUNET_TIME_Timestamp *start_date,
+ struct GNUNET_TIME_Timestamp *end_date,
struct TALER_Amount *wire_fee,
struct TALER_Amount *closing_fee,
struct TALER_MasterSignatureP *master_sig);
@@ -3134,7 +3134,7 @@ struct TALER_EXCHANGEDB_Plugin
*/
enum GNUNET_DB_QueryStatus
(*get_expired_reserves)(void *cls,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
TALER_EXCHANGEDB_ReserveExpiredCallback rec,
void *rec_cls);
@@ -3154,7 +3154,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_reserve_closed)(void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
- struct GNUNET_TIME_Absolute execution_date,
+ struct GNUNET_TIME_Timestamp execution_date,
const char *receiver_account,
const struct TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *amount_with_fee,
@@ -3248,7 +3248,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*store_wire_transfer_out)(
void *cls,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
uint64_t wire_target,
const char *exchange_account_section,
@@ -3486,7 +3486,7 @@ struct TALER_EXCHANGEDB_Plugin
const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct TALER_BlindedCoinHash *h_blind_ev,
- struct GNUNET_TIME_Absolute timestamp);
+ struct GNUNET_TIME_Timestamp timestamp);
/**
@@ -3511,7 +3511,7 @@ struct TALER_EXCHANGEDB_Plugin
const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct TALER_BlindedCoinHash *h_blind_ev,
- struct GNUNET_TIME_Absolute timestamp);
+ struct GNUNET_TIME_Timestamp timestamp);
/**
@@ -3592,8 +3592,8 @@ struct TALER_EXCHANGEDB_Plugin
*/
enum GNUNET_DB_QueryStatus
(*select_deposits_missing_wire)(void *cls,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
TALER_EXCHANGEDB_WireMissingCallback cb,
void *cb_cls);
@@ -3609,7 +3609,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_auditor_timestamp)(void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute *last_date);
+ struct GNUNET_TIME_Timestamp *last_date);
/**
@@ -3645,7 +3645,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute start_date);
+ struct GNUNET_TIME_Timestamp start_date);
/**
@@ -3665,7 +3665,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute change_date,
+ struct GNUNET_TIME_Timestamp change_date,
bool enabled);
@@ -3680,7 +3680,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_wire_timestamp)(void *cls,
const char *payto_uri,
- struct GNUNET_TIME_Absolute *last_date);
+ struct GNUNET_TIME_Timestamp *last_date);
/**
@@ -3697,7 +3697,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_wire)(void *cls,
const char *payto_uri,
- struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig);
@@ -3714,7 +3714,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*update_wire)(void *cls,
const char *payto_uri,
- struct GNUNET_TIME_Absolute change_date,
+ struct GNUNET_TIME_Timestamp change_date,
bool enabled);
@@ -3899,8 +3899,8 @@ struct TALER_EXCHANGEDB_Plugin
(*lookup_wire_fee_by_time)(
void *cls,
const char *wire_method,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
struct TALER_Amount *wire_fee,
struct TALER_Amount *closing_fee);
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 73d0c418f..b20bd4ea4 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -40,20 +40,6 @@
/**
* Generate packer instruction for a JSON field of type
- * absolute time.
- * The absolute time value is expected to be already rounded.
- *
- * @param name name of the field to add to the object
- * @param at absolute time to pack
- * @return json pack specification
- */
-struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_abs (const char *name,
- struct GNUNET_TIME_Absolute at);
-
-
-/**
- * Generate packer instruction for a JSON field of type
* absolute time creating a human-readable timestamp.
*
* @param name name of the field to add to the object
@@ -66,20 +52,6 @@ TALER_JSON_pack_time_abs_human (const char *name,
/**
- * Generate packer instruction for a JSON field of type
- * absolute time in network byte order.
- * The absolute time value is expected to be already rounded.
- *
- * @param name name of the field to add to the object
- * @param at absolute time to pack
- * @return json pack specification
- */
-struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_abs_nbo (const char *name,
- struct GNUNET_TIME_AbsoluteNBO at);
-
-
-/**
* Put an error code into a JSON reply, including
* both the numeric value and the hint.
*
@@ -104,34 +76,6 @@ TALER_JSON_pack_time_abs_nbo_human (const char *name,
/**
* Generate packer instruction for a JSON field of type
- * relative time.
- * The relative time value is expected to be already rounded.
- *
- * @param name name of the field to add to the object
- * @param rt relative time to pack
- * @return json pack specification
- */
-struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_rel (const char *name,
- struct GNUNET_TIME_Relative rt);
-
-
-/**
- * Generate packer instruction for a JSON field of type
- * relative time in network byte order.
- * The relative time value is expected to be already rounded.
- *
- * @param name name of the field to add to the object
- * @param rt relative time to pack
- * @return json pack specification
- */
-struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_rel_nbo (const char *name,
- struct GNUNET_TIME_RelativeNBO rt);
-
-
-/**
- * Generate packer instruction for a JSON field of type
* denomination public key.
*
* @param name name of the field to add to the object
@@ -279,46 +223,6 @@ TALER_JSON_spec_amount_any_nbo (const char *name,
/**
- * Provide specification to parse given JSON object to an absolute time.
- * The absolute time value is expected to be already rounded.
- *
- * @param name name of the time field in the JSON
- * @param[out] r_time where the time has to be written
- * @return spec for parsing an absolute time
- */
-struct GNUNET_JSON_Specification
-TALER_JSON_spec_absolute_time (const char *name,
- struct GNUNET_TIME_Absolute *r_time);
-
-
-/**
- * Provide specification to parse given JSON object to an absolute time
- * in network byte order.
- * The absolute time value is expected to be already rounded.
- *
- * @param name name of the time field in the JSON
- * @param[out] r_time where the time has to be written
- * @return spec for parsing an absolute time
- */
-struct GNUNET_JSON_Specification
-TALER_JSON_spec_absolute_time_nbo (const char *name,
- struct GNUNET_TIME_AbsoluteNBO *r_time);
-
-
-/**
- * Provide specification to parse given JSON object to a relative time.
- * The absolute time value is expected to be already rounded.
- *
- * @param name name of the time field in the JSON
- * @param[out] r_time where the time has to be written
- * @return spec for parsing a relative time
- */
-struct GNUNET_JSON_Specification
-TALER_JSON_spec_relative_time (const char *name,
- struct GNUNET_TIME_Relative *r_time);
-
-
-/**
* Generate line in parser specification for denomination public key.
*
* @param field name of the field
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index 6e69cdf6d..2189a4f61 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -102,33 +102,6 @@ TALER_PQ_query_param_json (const json_t *x);
/**
- * Generate query parameter for an absolute time value.
- * In contrast to
- * #GNUNET_PQ_query_param_absolute_time(), this function
- * will abort (!) if the time given is not rounded!
- * The database must store a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
-struct GNUNET_PQ_QueryParam
-TALER_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x);
-
-
-/**
- * Generate query parameter for an absolute time value.
- * In contrast to
- * #GNUNET_PQ_query_param_absolute_time(), this function
- * will abort (!) if the time given is not rounded!
- * The database must store a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
-struct GNUNET_PQ_QueryParam
-TALER_PQ_query_param_absolute_time_nbo (const struct
- GNUNET_TIME_AbsoluteNBO *x);
-
-
-/**
* Currency amount expected.
*
* @param name name of the field in the table
@@ -205,36 +178,6 @@ TALER_PQ_result_spec_json (const char *name,
json_t **jp);
-/**
- * Rounded absolute time expected.
- * In contrast to #GNUNET_PQ_query_param_absolute_time_nbo(),
- * this function ensures that the result is rounded and can
- * be converted to JSON.
- *
- * @param name name of the field in the table
- * @param[out] at where to store the result
- * @return array entry for the result specification to use
- */
-struct GNUNET_PQ_ResultSpec
-TALER_PQ_result_spec_absolute_time (const char *name,
- struct GNUNET_TIME_Absolute *at);
-
-
-/**
- * Rounded absolute time expected.
- * In contrast to #GNUNET_PQ_result_spec_absolute_time_nbo(),
- * this function ensures that the result is rounded and can
- * be converted to JSON.
- *
- * @param name name of the field in the table
- * @param[out] at where to store the result
- * @return array entry for the result specification to use
- */
-struct GNUNET_PQ_ResultSpec
-TALER_PQ_result_spec_absolute_time_nbo (const char *name,
- struct GNUNET_TIME_AbsoluteNBO *at);
-
-
#endif /* TALER_PQ_LIB_H_ */
/* end of include/taler_pq_lib.h */
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 991c56e65..87a004e31 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -342,7 +342,7 @@ struct TALER_DenominationKeyAnnouncementPS
/**
* When does the key become available?
*/
- struct GNUNET_TIME_AbsoluteNBO anchor_time;
+ struct GNUNET_TIME_TimestampNBO anchor_time;
/**
* How long is the key available after @e anchor_time?
@@ -373,7 +373,7 @@ struct TALER_SigningKeyAnnouncementPS
/**
* When does the key become available?
*/
- struct GNUNET_TIME_AbsoluteNBO anchor_time;
+ struct GNUNET_TIME_TimestampNBO anchor_time;
/**
* How long is the key available after @e anchor_time?
@@ -497,14 +497,14 @@ struct TALER_DepositRequestPS
* deposit request in a timely fashion (so back-dating is not
* prevented).
*/
- struct GNUNET_TIME_AbsoluteNBO wallet_timestamp;
+ struct GNUNET_TIME_TimestampNBO wallet_timestamp;
/**
* How much time does the merchant have to issue a refund request?
* Zero if refunds are not allowed. After this time, the coin
* cannot be refunded.
*/
- struct GNUNET_TIME_AbsoluteNBO refund_deadline;
+ struct GNUNET_TIME_TimestampNBO refund_deadline;
/**
* Amount to be deposited, including deposit fee charged by the
@@ -565,13 +565,13 @@ struct TALER_DepositConfirmationPS
* Time when this confirmation was generated / when the exchange received
* the deposit request.
*/
- struct GNUNET_TIME_AbsoluteNBO exchange_timestamp;
+ struct GNUNET_TIME_TimestampNBO exchange_timestamp;
/**
* By when does the exchange expect to pay the merchant
* (as per the merchant's request).
*/
- struct GNUNET_TIME_AbsoluteNBO wire_deadline;
+ struct GNUNET_TIME_TimestampNBO wire_deadline;
/**
* How much time does the @e merchant have to issue a refund
@@ -580,7 +580,7 @@ struct TALER_DepositConfirmationPS
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
- struct GNUNET_TIME_AbsoluteNBO refund_deadline;
+ struct GNUNET_TIME_TimestampNBO refund_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@@ -782,7 +782,7 @@ struct TALER_ExchangeSigningKeyValidityPS
/**
* When does this signing key begin to be valid?
*/
- struct GNUNET_TIME_AbsoluteNBO start;
+ struct GNUNET_TIME_TimestampNBO start;
/**
* When does this signing key expire? Note: This is currently when
@@ -792,7 +792,7 @@ struct TALER_ExchangeSigningKeyValidityPS
* the use of either key during the overlap time (due to the
* possibility of clock skew).
*/
- struct GNUNET_TIME_AbsoluteNBO expire;
+ struct GNUNET_TIME_TimestampNBO expire;
/**
* When do signatures with this signing key become invalid? After
@@ -801,7 +801,7 @@ struct TALER_ExchangeSigningKeyValidityPS
* evidence. @e end is expected to be significantly larger than @e
* expire (by a year or more).
*/
- struct GNUNET_TIME_AbsoluteNBO end;
+ struct GNUNET_TIME_TimestampNBO end;
/**
* The public online signing key that the exchange will use
@@ -828,7 +828,7 @@ struct TALER_ExchangeKeySetPS
/**
* Time of the key set issue.
*/
- struct GNUNET_TIME_AbsoluteNBO list_issue_date;
+ struct GNUNET_TIME_TimestampNBO list_issue_date;
/**
* Hash over the various denomination signing keys returned.
@@ -858,7 +858,7 @@ struct TALER_ExchangeAccountSetupSuccessPS
/**
* When was the signature made.
*/
- struct GNUNET_TIME_AbsoluteNBO timestamp;
+ struct GNUNET_TIME_TimestampNBO timestamp;
};
@@ -878,7 +878,7 @@ struct TALER_MasterAddAuditorPS
/**
* Time of the change.
*/
- struct GNUNET_TIME_AbsoluteNBO start_date;
+ struct GNUNET_TIME_TimestampNBO start_date;
/**
* Public key of the auditor.
@@ -908,7 +908,7 @@ struct TALER_MasterDelAuditorPS
/**
* Time of the change.
*/
- struct GNUNET_TIME_AbsoluteNBO end_date;
+ struct GNUNET_TIME_TimestampNBO end_date;
/**
* Public key of the auditor.
@@ -934,7 +934,7 @@ struct TALER_MasterAddWirePS
/**
* Time of the change.
*/
- struct GNUNET_TIME_AbsoluteNBO start_date;
+ struct GNUNET_TIME_TimestampNBO start_date;
/**
* Hash over the exchange's payto URI.
@@ -959,7 +959,7 @@ struct TALER_MasterDelWirePS
/**
* Time of the change.
*/
- struct GNUNET_TIME_AbsoluteNBO end_date;
+ struct GNUNET_TIME_TimestampNBO end_date;
/**
* Hash over the exchange's payto URI.
@@ -990,7 +990,7 @@ struct TALER_DenominationKeyValidityPS
/**
* Start time of the validity period for this key.
*/
- struct GNUNET_TIME_AbsoluteNBO start;
+ struct GNUNET_TIME_TimestampNBO start;
/**
* The exchange will sign fresh coins between @e start and this time.
@@ -1004,7 +1004,7 @@ struct TALER_DenominationKeyValidityPS
* with the same value with overlapping validity periods, to address
* issues such as clock skew.
*/
- struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
+ struct GNUNET_TIME_TimestampNBO expire_withdraw;
/**
* Coins signed with the denomination key must be spent or refreshed
@@ -1016,7 +1016,7 @@ struct TALER_DenominationKeyValidityPS
* significantly larger than @e expire_withdraw (by months or even
* years).
*/
- struct GNUNET_TIME_AbsoluteNBO expire_deposit;
+ struct GNUNET_TIME_TimestampNBO expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@@ -1025,7 +1025,7 @@ struct TALER_DenominationKeyValidityPS
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
- struct GNUNET_TIME_AbsoluteNBO expire_legal;
+ struct GNUNET_TIME_TimestampNBO expire_legal;
/**
* The value of the coins signed with this denomination key.
@@ -1093,7 +1093,7 @@ struct TALER_ExchangeKeyValidityPS
/**
* Start time of the validity period for this key.
*/
- struct GNUNET_TIME_AbsoluteNBO start;
+ struct GNUNET_TIME_TimestampNBO start;
/**
* The exchange will sign fresh coins between @e start and this time.
@@ -1107,7 +1107,7 @@ struct TALER_ExchangeKeyValidityPS
* with the same value with overlapping validity periods, to address
* issues such as clock skew.
*/
- struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
+ struct GNUNET_TIME_TimestampNBO expire_withdraw;
/**
* Coins signed with the denomination key must be spent or refreshed
@@ -1119,7 +1119,7 @@ struct TALER_ExchangeKeyValidityPS
* significantly larger than @e expire_withdraw (by months or even
* years).
*/
- struct GNUNET_TIME_AbsoluteNBO expire_deposit;
+ struct GNUNET_TIME_TimestampNBO expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@@ -1128,7 +1128,7 @@ struct TALER_ExchangeKeyValidityPS
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
- struct GNUNET_TIME_AbsoluteNBO expire_legal;
+ struct GNUNET_TIME_TimestampNBO expire_legal;
/**
* The value of the coins signed with this denomination key.
@@ -1231,12 +1231,12 @@ struct TALER_MasterWireFeePS
/**
* Start date when the fee goes into effect.
*/
- struct GNUNET_TIME_AbsoluteNBO start_date;
+ struct GNUNET_TIME_TimestampNBO start_date;
/**
* End date when the fee stops being in effect (exclusive)
*/
- struct GNUNET_TIME_AbsoluteNBO end_date;
+ struct GNUNET_TIME_TimestampNBO end_date;
/**
* Fee charged to the merchant per wire transfer.
@@ -1338,7 +1338,7 @@ struct TALER_WireDepositDetailP
/**
* Time when the wire transfer was performed by the exchange.
*/
- struct GNUNET_TIME_AbsoluteNBO execution_time;
+ struct GNUNET_TIME_TimestampNBO execution_time;
/**
* Coin's public key.
@@ -1473,7 +1473,7 @@ struct TALER_ConfirmWirePS
* timestamp may not be exactly the same on the wire, i.e.
* because the wire has a different timezone or resolution.
*/
- struct GNUNET_TIME_AbsoluteNBO execution_time;
+ struct GNUNET_TIME_TimestampNBO execution_time;
/**
* The contribution of @e coin_pub to the total transfer volume.
@@ -1532,7 +1532,7 @@ struct TALER_RecoupConfirmationPS
* Indirectly determines when the wire transfer is (likely)
* to happen.
*/
- struct GNUNET_TIME_AbsoluteNBO timestamp;
+ struct GNUNET_TIME_TimestampNBO timestamp;
/**
* How much of the coin's value will the exchange transfer?
@@ -1570,7 +1570,7 @@ struct TALER_RecoupRefreshConfirmationPS
* Indirectly determines when the wire transfer is (likely)
* to happen.
*/
- struct GNUNET_TIME_AbsoluteNBO timestamp;
+ struct GNUNET_TIME_TimestampNBO timestamp;
/**
* How much of the coin's value will the exchange transfer?
@@ -1605,7 +1605,7 @@ struct TALER_DenominationUnknownAffirmationPS
/**
* When did the exchange sign this message.
*/
- struct GNUNET_TIME_AbsoluteNBO timestamp;
+ struct GNUNET_TIME_TimestampNBO timestamp;
/**
* Hash of the public denomination key we do not know.
@@ -1630,7 +1630,7 @@ struct TALER_DenominationExpiredAffirmationPS
/**
* When did the exchange sign this message.
*/
- struct GNUNET_TIME_AbsoluteNBO timestamp;
+ struct GNUNET_TIME_TimestampNBO timestamp;
/**
* Name of the operation that is not allowed at this time. Might NOT be 0-terminated, but is padded with 0s.
@@ -1660,7 +1660,7 @@ struct TALER_ReserveCloseConfirmationPS
/**
* When did the exchange initiate the wire transfer.
*/
- struct GNUNET_TIME_AbsoluteNBO timestamp;
+ struct GNUNET_TIME_TimestampNBO timestamp;
/**
* How much did the exchange send?
diff --git a/src/include/taler_sq_lib.h b/src/include/taler_sq_lib.h
index 66bd38c82..b5749308e 100644
--- a/src/include/taler_sq_lib.h
+++ b/src/include/taler_sq_lib.h
@@ -61,33 +61,6 @@ TALER_SQ_query_param_json (const json_t *x);
/**
- * Generate query parameter for an absolute time value.
- * In contrast to
- * #GNUNET_SQ_query_param_absolute_time(), this function
- * will abort (!) if the time given is not rounded!
- * The database must store a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
-struct GNUNET_SQ_QueryParam
-TALER_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x);
-
-
-/**
- * Generate query parameter for an absolute time value.
- * In contrast to
- * #GNUNET_SQ_query_param_absolute_time(), this function
- * will abort (!) if the time given is not rounded!
- * The database must store a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
-struct GNUNET_SQ_QueryParam
-TALER_SQ_query_param_absolute_time_nbo (const struct
- GNUNET_TIME_AbsoluteNBO *x);
-
-
-/**
* Currency amount expected.
*
* @param currency currency to use for @a amount
@@ -121,32 +94,6 @@ struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_json (json_t **jp);
-/**
- * Rounded absolute time expected.
- * In contrast to #GNUNET_SQ_query_param_absolute_time_nbo(),
- * this function ensures that the result is rounded and can
- * be converted to JSON.
- *
- * @param[out] at where to store the result
- * @return array entry for the result specification to use
- */
-struct GNUNET_SQ_ResultSpec
-TALER_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at);
-
-
-/**
- * Rounded absolute time expected.
- * In contrast to #GNUNET_SQ_result_spec_absolute_time_nbo(),
- * this function ensures that the result is rounded and can
- * be converted to JSON.
- *
- * @param[out] at where to store the result
- * @return array entry for the result specification to use
- */
-struct GNUNET_SQ_ResultSpec
-TALER_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at);
-
-
#endif /* TALER_SQ_LIB_H_ */
/* end of include/taler_sq_lib.h */
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index f50e13a21..4733cf2f6 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -133,7 +133,7 @@ struct TALER_TESTING_LibeufinServices
* @return #GNUNET_OK on success, #GNUNET_NO if test should be
* skipped, #GNUNET_SYSERR on test failure
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_exchange (const char *config_filename,
int reset_db,
struct TALER_TESTING_ExchangeConfiguration *ec);
@@ -208,7 +208,7 @@ TALER_TESTING_cleanup_files (const char *config_name);
* @param cfg configuration
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_cleanup_files_cfg (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg);
@@ -222,7 +222,7 @@ TALER_TESTING_cleanup_files_cfg (void *cls,
* @param auditor_url URL of auditor to enable, can be NULL
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_run_exchange_offline (const char *config_filename,
const char *payto_uri,
const char *auditor_pub,
@@ -235,7 +235,7 @@ TALER_TESTING_run_exchange_offline (const char *config_filename,
* @param config_filename configuration file to use
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_auditor_db_reset (const char *config_filename);
@@ -245,7 +245,7 @@ TALER_TESTING_auditor_db_reset (const char *config_filename);
* @param config_filename configuration file to use
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_exchange_db_reset (const char *config_filename);
@@ -255,7 +255,7 @@ TALER_TESTING_exchange_db_reset (const char *config_filename);
* @param config_filename configuration file to use
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_run_auditor_offline (const char *config_filename);
@@ -268,7 +268,7 @@ TALER_TESTING_run_auditor_offline (const char *config_filename);
* @param do_remove #GNUNET_NO to add exchange, #GNUNET_YES to remove
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_run_auditor_exchange (const char *config_filename,
const char *exchange_master_pub,
const char *exchange_base_url,
@@ -281,7 +281,7 @@ TALER_TESTING_run_auditor_exchange (const char *config_filename,
* @param url URL to extract port from, 80 is default
* @return #GNUNET_OK if the port is free
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_url_port_free (const char *url);
@@ -324,7 +324,7 @@ struct TALER_TESTING_BankConfiguration
* @param[out] bc set to the bank's configuration data
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_fakebank (const char *config_filename,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc);
@@ -531,7 +531,7 @@ struct TALER_TESTING_Command
* @param index index number of the object to extract.
* @return #GNUNET_OK on success
*/
- int
+ enum GNUNET_GenericReturnValue
(*traits)(void *cls,
const void **ret,
const char *trait,
@@ -731,7 +731,7 @@ typedef void
* non-#GNUNET_OK codes are #GNUNET_SYSERR most of the
* times.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_setup (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -751,7 +751,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
* non-GNUNET_OK codes are #GNUNET_SYSERR most of the
* times.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_auditor_setup (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const char *config_filename);
@@ -788,7 +788,7 @@ struct TALER_TESTING_SetupContext
* @param cfg configuration to use.
* @return #GNUNET_OK if no errors occurred.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_exchange_cfg (
void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg);
@@ -809,7 +809,7 @@ TALER_TESTING_setup_with_exchange_cfg (
* at its base URL.
* @return #GNUNET_OK if no errors occurred.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const char *config_file);
@@ -824,7 +824,7 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
* @param cfg configuration to use.
* @return #GNUNET_OK if no errors occurred.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_auditor_and_exchange_cfg (
void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg);
@@ -845,7 +845,7 @@ TALER_TESTING_setup_with_auditor_and_exchange_cfg (
* at its base URL.
* @return #GNUNET_OK if no errors occurred.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const char *config_file);
@@ -905,7 +905,7 @@ TALER_TESTING_run_fakebank (const char *bank_url,
* @param[out] bc set to the bank's configuration data
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_bank (const char *config_filename,
int reset_db,
const char *config_section,
@@ -922,7 +922,7 @@ TALER_TESTING_prepare_bank (const char *config_filename,
* @return the base url, or NULL upon errors. Must be freed
* by the caller.
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_nexus (const char *config_filename,
int reset_db,
const char *config_section,
@@ -934,7 +934,7 @@ TALER_TESTING_prepare_nexus (const char *config_filename,
* @param prog program's name to look into
* @param marker chunk to find in @a prog
*/
-int
+enum GNUNET_GenericReturnValue
TALER_TESTING_has_in_name (const char *prog,
const char *marker);
@@ -1966,7 +1966,7 @@ TALER_TESTING_cmd_insert_deposit (
const struct TALER_TESTING_DatabaseConnection *dbc,
const char *merchant_name,
const char *merchant_account,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Relative wire_deadline,
const char *amount_with_fee,
const char *deposit_fee);
@@ -2446,12 +2446,12 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (debit_payto_uri, const char *) \
op (order_id, const char *) \
op (amount, const struct TALER_Amount) \
- op (amount_with_fee, const struct TALER_Amount) \
- op (deposit_amount, const struct TALER_Amount) \
- op (deposit_fee_amount, const struct TALER_Amount) \
+ op (amount_with_fee, const struct TALER_Amount) \
+ op (deposit_amount, const struct TALER_Amount) \
+ op (deposit_fee_amount, const struct TALER_Amount) \
op (batch_cmds, struct TALER_TESTING_Command *) \
op (uuid, const struct GNUNET_Uuid) \
- op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
+ op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
op (claim_token, const struct TALER_ClaimTokenP) \
op (relative_time, const struct GNUNET_TIME_Relative) \
op (process, struct GNUNET_OS_Process *)
@@ -2460,14 +2460,15 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
/**
* Call #op on all indexed traits.
*/
-#define TALER_TESTING_INDEXED_TRAITS(op) \
+#define TALER_TESTING_INDEXED_TRAITS(op) \
op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \
- op (denom_sig, const struct TALER_DenominationSignature) \
+ op (denom_sig, const struct TALER_DenominationSignature) \
op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \
op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \
op (absolute_time, const struct GNUNET_TIME_Absolute) \
- op (wire_deadline, const struct GNUNET_TIME_Absolute) \
- op (refund_deadline, const struct GNUNET_TIME_Absolute) \
+ op (timestamp, const struct GNUNET_TIME_Timestamp) \
+ op (wire_deadline, const struct GNUNET_TIME_Timestamp) \
+ op (refund_deadline, const struct GNUNET_TIME_Timestamp) \
op (exchange_pub, const struct TALER_ExchangePublicKeyP) \
op (exchange_sig, const struct TALER_ExchangeSignatureP) \
op (blinding_key, const union TALER_DenominationBlindingKeyP)
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 7c01cde0c..949354e24 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -216,219 +216,6 @@ TALER_JSON_spec_amount_any_nbo (const char *name,
/**
- * Parse given JSON object to *rounded* absolute time.
- *
- * @param cls closure, NULL
- * @param root the json object representing data
- * @param[out] spec where to write the data
- * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
- */
-static enum GNUNET_GenericReturnValue
-parse_abs_time (void *cls,
- json_t *root,
- struct GNUNET_JSON_Specification *spec)
-{
- struct GNUNET_TIME_Absolute *abs = spec->ptr;
- json_t *json_t_ms;
- unsigned long long int tval;
-
- (void) cls;
- if (! json_is_object (root))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- json_t_ms = json_object_get (root,
- "t_ms");
- if (json_is_integer (json_t_ms))
- {
- tval = json_integer_value (json_t_ms);
- /* Time is in milliseconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
- abs->abs_value_us = tval * 1000LL;
- if ((abs->abs_value_us) / 1000LL != tval)
- {
- /* Integer overflow */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_TIME_round_abs (abs))
- {
- /* time not rounded */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
- }
- if (json_is_string (json_t_ms))
- {
- const char *val;
-
- val = json_string_value (json_t_ms);
- if ((0 == strcasecmp (val, "never")))
- {
- *abs = GNUNET_TIME_UNIT_FOREVER_ABS;
- return GNUNET_OK;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "`%s' is not a valid absolute time\n",
- json_string_value (json_t_ms));
- return GNUNET_SYSERR;
- }
- return GNUNET_SYSERR;
-}
-
-
-struct GNUNET_JSON_Specification
-TALER_JSON_spec_absolute_time (const char *name,
- struct GNUNET_TIME_Absolute *r_time)
-{
- struct GNUNET_JSON_Specification ret = {
- .parser = &parse_abs_time,
- .cleaner = NULL,
- .cls = NULL,
- .field = name,
- .ptr = r_time,
- .ptr_size = sizeof(struct GNUNET_TIME_Absolute),
- .size_ptr = NULL
- };
-
- return ret;
-}
-
-
-/**
- * Parse given JSON object to absolute time.
- *
- * @param cls closure, NULL
- * @param root the json object representing data
- * @param[out] spec where to write the data
- * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
- */
-static enum GNUNET_GenericReturnValue
-parse_abs_time_nbo (void *cls,
- json_t *root,
- struct GNUNET_JSON_Specification *spec)
-{
- struct GNUNET_TIME_AbsoluteNBO *abs = spec->ptr;
- struct GNUNET_TIME_Absolute a;
- struct GNUNET_JSON_Specification ispec;
-
- (void) cls;
- ispec = *spec;
- ispec.parser = &parse_abs_time;
- ispec.ptr = &a;
- if (GNUNET_OK !=
- parse_abs_time (NULL,
- root,
- &ispec))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- *abs = GNUNET_TIME_absolute_hton (a);
- return GNUNET_OK;
-}
-
-
-struct GNUNET_JSON_Specification
-TALER_JSON_spec_absolute_time_nbo (const char *name,
- struct GNUNET_TIME_AbsoluteNBO *r_time)
-{
- struct GNUNET_JSON_Specification ret = {
- .parser = &parse_abs_time_nbo,
- .cleaner = NULL,
- .cls = NULL,
- .field = name,
- .ptr = r_time,
- .ptr_size = sizeof(struct GNUNET_TIME_AbsoluteNBO),
- .size_ptr = NULL
- };
-
- return ret;
-}
-
-
-/**
- * Parse given JSON object to relative time.
- *
- * @param cls closure, NULL
- * @param root the json object representing data
- * @param[out] spec where to write the data
- * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
- */
-static enum GNUNET_GenericReturnValue
-parse_rel_time (void *cls,
- json_t *root,
- struct GNUNET_JSON_Specification *spec)
-{
- struct GNUNET_TIME_Relative *rel = spec->ptr;
- json_t *json_d_ms;
- unsigned long long int tval;
-
- (void) cls;
- if (! json_is_object (root))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- json_d_ms = json_object_get (root, "d_ms");
- if (json_is_integer (json_d_ms))
- {
- tval = json_integer_value (json_d_ms);
- /* Time is in milliseconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
- rel->rel_value_us = tval * 1000LL;
- if ((rel->rel_value_us) / 1000LL != tval)
- {
- /* Integer overflow */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_TIME_round_rel (rel))
- {
- /* time not rounded */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
- }
- if (json_is_string (json_d_ms))
- {
- const char *val;
- val = json_string_value (json_d_ms);
- if ((0 == strcasecmp (val, "forever")))
- {
- *rel = GNUNET_TIME_UNIT_FOREVER_REL;
- return GNUNET_OK;
- }
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
-}
-
-
-struct GNUNET_JSON_Specification
-TALER_JSON_spec_relative_time (const char *name,
- struct GNUNET_TIME_Relative *r_time)
-{
- struct GNUNET_JSON_Specification ret = {
- .parser = &parse_rel_time,
- .cleaner = NULL,
- .cls = NULL,
- .field = name,
- .ptr = r_time,
- .ptr_size = sizeof(struct GNUNET_TIME_Relative),
- .size_ptr = NULL
- };
-
- return ret;
-}
-
-
-/**
* Parse given JSON object to denomination public key.
*
* @param cls closure, NULL
diff --git a/src/json/json_pack.c b/src/json/json_pack.c
index f41ba5234..6fea72a39 100644
--- a/src/json/json_pack.c
+++ b/src/json/json_pack.c
@@ -25,17 +25,6 @@
struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_abs (const char *name,
- struct GNUNET_TIME_Absolute at)
-{
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&at));
- return GNUNET_JSON_pack_time_abs (name,
- at);
-}
-
-
-struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs_human (const char *name,
struct GNUNET_TIME_Absolute at)
{
@@ -50,15 +39,6 @@ TALER_JSON_pack_time_abs_human (const char *name,
struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_abs_nbo (const char *name,
- struct GNUNET_TIME_AbsoluteNBO at)
-{
- return TALER_JSON_pack_time_abs (name,
- GNUNET_TIME_absolute_ntoh (at));
-}
-
-
-struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs_nbo_human (const char *name,
struct GNUNET_TIME_AbsoluteNBO at)
{
@@ -68,26 +48,6 @@ TALER_JSON_pack_time_abs_nbo_human (const char *name,
struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_rel (const char *name,
- struct GNUNET_TIME_Relative rt)
-{
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_rel (&rt));
- return GNUNET_JSON_pack_time_rel (name,
- rt);
-}
-
-
-struct GNUNET_JSON_PackSpec
-TALER_JSON_pack_time_rel_nbo (const char *name,
- struct GNUNET_TIME_RelativeNBO rt)
-{
- return TALER_JSON_pack_time_rel (name,
- GNUNET_TIME_relative_ntoh (rt));
-}
-
-
-struct GNUNET_JSON_PackSpec
TALER_JSON_pack_denom_pub (
const char *name,
const struct TALER_DenominationPublicKey *pk)
diff --git a/src/lib/auditor_api_curl_defaults.c b/src/lib/auditor_api_curl_defaults.c
index d8c6f619c..81fcd7bac 100644
--- a/src/lib/auditor_api_curl_defaults.c
+++ b/src/lib/auditor_api_curl_defaults.c
@@ -22,12 +22,6 @@
#include "auditor_api_curl_defaults.h"
-/**
- * Get a curl handle with the right defaults
- * for the exchange lib. In the future, we might manage a pool of connections here.
- *
- * @param url URL to query
- */
CURL *
TALER_AUDITOR_curl_easy_get_ (const char *url)
{
@@ -47,6 +41,12 @@ TALER_AUDITOR_curl_easy_get_ (const char *url)
curl_easy_setopt (eh,
CURLOPT_FOLLOWLOCATION,
1L));
+ /* Enable compression (using whatever curl likes), see
+ https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html */
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_ACCEPT_ENCODING,
+ ""));
/* limit MAXREDIRS to 5 as a simple security measure against
a potential infinite loop caused by a malicious target */
GNUNET_assert (CURLE_OK ==
diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c
index 5b207a18c..cdf1c5ef3 100644
--- a/src/lib/auditor_api_deposit_confirmation.c
+++ b/src/lib/auditor_api_deposit_confirmation.c
@@ -173,18 +173,18 @@ static enum GNUNET_GenericReturnValue
verify_signatures (const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute ep_start,
- struct GNUNET_TIME_Absolute ep_expire,
- struct GNUNET_TIME_Absolute ep_end,
+ struct GNUNET_TIME_Timestamp ep_start,
+ struct GNUNET_TIME_Timestamp ep_expire,
+ struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig)
{
if (GNUNET_OK !=
@@ -223,7 +223,7 @@ verify_signatures (const struct TALER_MerchantWireHash *h_wire,
TALER_LOG_WARNING ("Invalid signature on exchange signing key!\n");
return GNUNET_SYSERR;
}
- if (GNUNET_TIME_absolute_is_past (ep_end))
+ if (GNUNET_TIME_absolute_is_past (ep_end.abs_time))
{
GNUNET_break (0);
TALER_LOG_WARNING ("Exchange signing key is no longer valid!\n");
@@ -239,18 +239,18 @@ TALER_AUDITOR_deposit_confirmation (
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute ep_start,
- struct GNUNET_TIME_Absolute ep_expire,
- struct GNUNET_TIME_Absolute ep_end,
+ struct GNUNET_TIME_Timestamp ep_start,
+ struct GNUNET_TIME_Timestamp ep_expire,
+ struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_AUDITOR_DepositConfirmationResultCallback cb,
void *cb_cls)
@@ -260,11 +260,6 @@ TALER_AUDITOR_deposit_confirmation (
json_t *deposit_confirmation_obj;
CURL *eh;
- (void) GNUNET_TIME_round_abs (&exchange_timestamp);
- (void) GNUNET_TIME_round_abs (&refund_deadline);
- (void) GNUNET_TIME_round_abs (&ep_start);
- (void) GNUNET_TIME_round_abs (&ep_expire);
- (void) GNUNET_TIME_round_abs (&ep_end);
GNUNET_assert (GNUNET_YES ==
TALER_AUDITOR_handle_is_ready_ (auditor));
if (GNUNET_OK !=
@@ -297,12 +292,12 @@ TALER_AUDITOR_deposit_confirmation (
h_extensions),
GNUNET_JSON_pack_data_auto ("h_contract_terms",
h_contract_terms),
- GNUNET_JSON_pack_time_abs ("exchange_timestamp",
- exchange_timestamp),
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- refund_deadline),
- GNUNET_JSON_pack_time_abs ("wire_deadline",
- wire_deadline),
+ GNUNET_JSON_pack_timestamp ("exchange_timestamp",
+ exchange_timestamp),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ refund_deadline),
+ GNUNET_JSON_pack_timestamp ("wire_deadline",
+ wire_deadline),
TALER_JSON_pack_amount ("amount_without_fee",
amount_without_fee),
GNUNET_JSON_pack_data_auto ("coin_pub",
@@ -313,12 +308,12 @@ TALER_AUDITOR_deposit_confirmation (
exchange_sig),
GNUNET_JSON_pack_data_auto ("master_pub",
master_pub),
- GNUNET_JSON_pack_time_abs ("ep_start",
- ep_start),
- GNUNET_JSON_pack_time_abs ("ep_expire",
- ep_expire),
- GNUNET_JSON_pack_time_abs ("ep_end",
- ep_end),
+ GNUNET_JSON_pack_timestamp ("ep_start",
+ ep_start),
+ GNUNET_JSON_pack_timestamp ("ep_expire",
+ ep_expire),
+ GNUNET_JSON_pack_timestamp ("ep_end",
+ ep_end),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
diff --git a/src/lib/exchange_api_auditor_add_denomination.c b/src/lib/exchange_api_auditor_add_denomination.c
index fbe46e51f..27eb43bcf 100644
--- a/src/lib/exchange_api_auditor_add_denomination.c
+++ b/src/lib/exchange_api_auditor_add_denomination.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "auditor_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -190,7 +191,7 @@ TALER_EXCHANGE_add_auditor_denomination (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("auditor_sig",
auditor_sig));
- eh = curl_easy_init ();
+ eh = TALER_AUDITOR_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@@ -207,9 +208,6 @@ TALER_EXCHANGE_add_auditor_denomination (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 98a6ab20f..b14714ac6 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -86,12 +86,12 @@ TALER_EXCHANGE_parse_reserve_history (
{
const char *wire_url;
uint64_t wire_reference;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_uint64 ("wire_reference",
&wire_reference),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_string ("sender_account_url",
&wire_url),
GNUNET_JSON_spec_end ()
@@ -226,7 +226,7 @@ TALER_EXCHANGE_parse_reserve_history (
"RECOUP"))
{
struct TALER_RecoupConfirmationPS pc;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification recoup_spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_pub",
@@ -235,8 +235,8 @@ TALER_EXCHANGE_parse_reserve_history (
&rh->details.recoup_details.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&rh->details.recoup_details.exchange_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -256,7 +256,7 @@ TALER_EXCHANGE_parse_reserve_history (
pc.purpose.size = htonl (sizeof (pc));
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.reserve_pub = *reserve_pub;
- timestamp = GNUNET_TIME_absolute_ntoh (pc.timestamp);
+ timestamp = GNUNET_TIME_timestamp_ntoh (pc.timestamp);
rh->details.recoup_details.timestamp = timestamp;
key_state = TALER_EXCHANGE_get_keys (exchange);
@@ -294,7 +294,7 @@ TALER_EXCHANGE_parse_reserve_history (
{
const struct TALER_EXCHANGE_Keys *key_state;
struct TALER_ReserveCloseConfirmationPS rcc;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification closing_spec[] = {
GNUNET_JSON_spec_string (
"receiver_account_details",
@@ -307,8 +307,8 @@ TALER_EXCHANGE_parse_reserve_history (
&rh->details.close_details.exchange_pub),
TALER_JSON_spec_amount_any_nbo ("closing_fee",
&rcc.closing_fee),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &rcc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &rcc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -330,7 +330,7 @@ TALER_EXCHANGE_parse_reserve_history (
rcc.purpose.size = htonl (sizeof (rcc));
rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);
rcc.reserve_pub = *reserve_pub;
- timestamp = GNUNET_TIME_absolute_ntoh (rcc.timestamp);
+ timestamp = GNUNET_TIME_timestamp_ntoh (rcc.timestamp);
rh->details.close_details.timestamp = timestamp;
TALER_amount_ntoh (&rh->details.close_details.fee,
&rcc.closing_fee);
@@ -478,9 +478,9 @@ TALER_EXCHANGE_verify_coin_history (
struct TALER_MerchantWireHash h_wire;
struct TALER_PrivateContractHash h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME!
- struct GNUNET_TIME_Absolute wallet_timestamp;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
- struct GNUNET_TIME_Absolute refund_deadline = {0};
+ struct GNUNET_TIME_Timestamp refund_deadline = {0};
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
@@ -491,11 +491,11 @@ TALER_EXCHANGE_verify_coin_history (
&h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
h_denom_pub),
- TALER_JSON_spec_absolute_time ("timestamp",
- &wallet_timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &wallet_timestamp),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline)),
TALER_JSON_spec_amount_any ("deposit_fee",
&fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
@@ -711,8 +711,8 @@ TALER_EXCHANGE_verify_coin_history (
&rr.coin_blind),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rr.h_denom_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -781,8 +781,8 @@ TALER_EXCHANGE_verify_coin_history (
&rr.coin_blind),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rr.h_denom_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -840,8 +840,8 @@ TALER_EXCHANGE_verify_coin_history (
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("coin_pub",
&pc.coin_pub),
- TALER_JSON_spec_absolute_time_nbo ("timestamp",
- &pc.timestamp),
+ GNUNET_JSON_spec_timestamp_nbo ("timestamp",
+ &pc.timestamp),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/exchange_api_curl_defaults.c b/src/lib/exchange_api_curl_defaults.c
index 6d6016953..9627db9ff 100644
--- a/src/lib/exchange_api_curl_defaults.c
+++ b/src/lib/exchange_api_curl_defaults.c
@@ -30,7 +30,10 @@ TALER_EXCHANGE_curl_easy_get_ (const char *url)
eh = curl_easy_init ();
if (NULL == eh)
+ {
+ GNUNET_break (0);
return NULL;
+ }
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 3fd3353b2..de67bc5f2 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -100,13 +100,13 @@ struct TALER_EXCHANGE_DepositHandle
* Time when this confirmation was generated / when the exchange received
* the deposit request.
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* By when does the exchange expect to pay the merchant
* (as per the merchant's request).
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* How much time does the @e merchant have to issue a refund
@@ -115,7 +115,7 @@ struct TALER_EXCHANGE_DepositHandle
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@@ -334,8 +334,8 @@ handle_deposit_finished (void *cls,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("transaction_base_url",
&dr.details.success.transaction_base_url)),
- TALER_JSON_spec_absolute_time ("exchange_timestamp",
- &dh->exchange_timestamp),
+ GNUNET_JSON_spec_timestamp ("exchange_timestamp",
+ &dh->exchange_timestamp),
GNUNET_JSON_spec_end ()
};
@@ -481,9 +481,9 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationHash *denom_pub_hash,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig)
{
if (GNUNET_OK !=
@@ -543,7 +543,7 @@ struct TALER_EXCHANGE_DepositHandle *
TALER_EXCHANGE_deposit (
struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- struct GNUNET_TIME_Absolute wire_deadline,
+ struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri,
const struct TALER_WireSalt *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms,
@@ -551,9 +551,9 @@ TALER_EXCHANGE_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig,
TALER_EXCHANGE_DepositResultCallback cb,
void *cb_cls,
@@ -589,9 +589,9 @@ TALER_EXCHANGE_deposit (
"/coins/%s/deposit",
pub_str);
}
- (void) GNUNET_TIME_round_abs (&wire_deadline);
- (void) GNUNET_TIME_round_abs (&refund_deadline);
- if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (refund_deadline,
+ >,
+ wire_deadline))
{
GNUNET_break_op (0);
*ec = TALER_EC_EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE;
@@ -658,15 +658,15 @@ TALER_EXCHANGE_deposit (
&denom_pub_hash),
TALER_JSON_pack_denom_sig ("ub_sig",
denom_sig),
- GNUNET_JSON_pack_time_abs ("timestamp",
- timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ timestamp),
GNUNET_JSON_pack_data_auto ("merchant_pub",
merchant_pub),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- refund_deadline)),
- GNUNET_JSON_pack_time_abs ("wire_transfer_deadline",
- wire_deadline),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ refund_deadline)),
+ GNUNET_JSON_pack_timestamp ("wire_transfer_deadline",
+ wire_deadline),
GNUNET_JSON_pack_data_auto ("coin_sig",
coin_sig));
dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle);
diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c
index 3c334d760..18fb9b7bd 100644
--- a/src/lib/exchange_api_deposits_get.c
+++ b/src/lib/exchange_api_deposits_get.c
@@ -147,8 +147,8 @@ handle_deposit_wtid_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("wtid",
&dr.details.success.wtid),
- TALER_JSON_spec_absolute_time ("execution_time",
- &dr.details.success.execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time",
+ &dr.details.success.execution_time),
TALER_JSON_spec_amount_any ("coin_contribution",
&dr.details.success.coin_contribution),
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
@@ -168,7 +168,7 @@ handle_deposit_wtid_finished (void *cls,
dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
break;
}
- dwh->depconf.execution_time = GNUNET_TIME_absolute_hton (
+ dwh->depconf.execution_time = GNUNET_TIME_timestamp_hton (
dr.details.success.execution_time);
dwh->depconf.wtid = dr.details.success.wtid;
TALER_amount_hton (&dwh->depconf.coin_contribution,
@@ -192,8 +192,8 @@ handle_deposit_wtid_finished (void *cls,
{
/* Transaction known, but not executed yet */
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("execution_time",
- &dr.details.accepted.execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time",
+ &dr.details.accepted.execution_time),
GNUNET_JSON_spec_uint64 ("payment_target_uuid",
&dr.details.accepted.payment_target_uuid),
GNUNET_JSON_spec_bool ("kyc_ok",
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 5898a0df4..0f2a079b4 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -39,7 +39,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define EXCHANGE_PROTOCOL_CURRENT 10
+#define EXCHANGE_PROTOCOL_CURRENT 11
/**
* How many versions are we backwards compatible with?
@@ -161,7 +161,7 @@ struct KeysRequest
* Expiration time according to "Expire:" header.
* 0 if not provided by the server.
*/
- struct GNUNET_TIME_Absolute expire;
+ struct GNUNET_TIME_Timestamp expire;
};
@@ -264,12 +264,12 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
&sign_key_issue_sig),
GNUNET_JSON_spec_fixed_auto ("key",
&sign_key->key),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &sign_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire",
- &sign_key->valid_until),
- TALER_JSON_spec_absolute_time ("stamp_end",
- &sign_key->valid_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &sign_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire",
+ &sign_key->valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_end",
+ &sign_key->valid_legal),
GNUNET_JSON_spec_end ()
};
@@ -322,14 +322,14 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_sig",
&denom_key->master_sig),
- TALER_JSON_spec_absolute_time ("stamp_expire_deposit",
- &denom_key->expire_deposit),
- TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &denom_key->withdraw_valid_until),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &denom_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire_legal",
- &denom_key->expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &denom_key->expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &denom_key->withdraw_valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &denom_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &denom_key->expire_legal),
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
TALER_JSON_spec_amount_any ("fee_withdraw",
@@ -675,10 +675,10 @@ decode_keys_json (const json_t *resp_obj,
&pub),
GNUNET_JSON_spec_fixed_auto ("master_public_key",
&key_data->master_pub),
- TALER_JSON_spec_absolute_time ("list_issue_date",
- &key_data->list_issue_date),
- TALER_JSON_spec_relative_time ("reserve_closing_delay",
- &key_data->reserve_closing_delay),
+ GNUNET_JSON_spec_timestamp ("list_issue_date",
+ &key_data->list_issue_date),
+ GNUNET_JSON_spec_relative_time ("reserve_closing_delay",
+ &key_data->reserve_closing_delay),
GNUNET_JSON_spec_string ("currency",
&currency),
GNUNET_JSON_spec_mark_optional (
@@ -843,10 +843,10 @@ decode_keys_json (const json_t *resp_obj,
/* Update "last_denom_issue_date" */
TALER_LOG_DEBUG ("Adding denomination key that is valid_until %s\n",
- GNUNET_STRINGS_absolute_time_to_string (dk.valid_from));
+ GNUNET_TIME_timestamp2s (dk.valid_from));
key_data->last_denom_issue_date
- = GNUNET_TIME_absolute_max (key_data->last_denom_issue_date,
- dk.valid_from);
+ = GNUNET_TIME_timestamp_max (key_data->last_denom_issue_date,
+ dk.valid_from);
};
}
@@ -970,7 +970,7 @@ decode_keys_json (const json_t *resp_obj,
struct TALER_ExchangeKeySetPS ks = {
.purpose.size = htonl (sizeof (ks)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET),
- .list_issue_date = GNUNET_TIME_absolute_hton (key_data->list_issue_date)
+ .list_issue_date = GNUNET_TIME_timestamp_hton (key_data->list_issue_date)
};
GNUNET_CRYPTO_hash_context_finish (hash_context,
@@ -1040,16 +1040,16 @@ request_keys (void *cls);
void
TALER_EXCHANGE_set_last_denom (struct TALER_EXCHANGE_Handle *exchange,
- struct GNUNET_TIME_Absolute last_denom_new)
+ struct GNUNET_TIME_Timestamp last_denom_new)
{
TALER_LOG_DEBUG (
"Application explicitly set last denomination validity to %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_denom_new));
+ GNUNET_TIME_timestamp2s (last_denom_new));
exchange->key_data.last_denom_issue_date = last_denom_new;
}
-struct GNUNET_TIME_Absolute
+struct GNUNET_TIME_Timestamp
TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
enum TALER_EXCHANGE_CheckKeysFlags flags)
{
@@ -1057,7 +1057,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
bool pull_all_keys = 0 != (flags & TALER_EXCHANGE_CKF_PULL_ALL_KEYS);
if (NULL != exchange->kr)
- return GNUNET_TIME_UNIT_ZERO_ABS;
+ return GNUNET_TIME_UNIT_ZERO_TS;
if (pull_all_keys)
{
@@ -1067,12 +1067,13 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
exchange->state = MHS_INIT;
}
if ( (! force_download) &&
- (GNUNET_TIME_absolute_is_future (exchange->key_data_expiration)) )
+ (GNUNET_TIME_absolute_is_future (
+ exchange->key_data_expiration.abs_time)) )
return exchange->key_data_expiration;
if (NULL == exchange->retry_task)
exchange->retry_task = GNUNET_SCHEDULER_add_now (&request_keys,
exchange);
- return GNUNET_TIME_UNIT_ZERO_ABS;
+ return GNUNET_TIME_UNIT_ZERO_TS;
}
@@ -1104,15 +1105,16 @@ keys_completed_cb (void *cls,
"Received keys from URL `%s' with status %ld and expiration %s.\n",
kr->url,
response_code,
- GNUNET_STRINGS_absolute_time_to_string (kr->expire));
- if (GNUNET_TIME_absolute_is_past (kr->expire))
+ GNUNET_TIME_timestamp2s (kr->expire));
+ if (GNUNET_TIME_absolute_is_past (kr->expire.abs_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Exchange failed to give expiration time, assuming in %s\n",
- GNUNET_STRINGS_relative_time_to_string (DEFAULT_EXPIRATION,
- GNUNET_YES));
- kr->expire = GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION);
- (void) GNUNET_TIME_round_abs (&kr->expire);
+ GNUNET_TIME_relative2s (DEFAULT_EXPIRATION,
+ true));
+ kr->expire
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION));
}
kd_old = exchange->key_data;
memset (&kd,
@@ -1250,13 +1252,14 @@ keys_completed_cb (void *cls,
break;
}
exchange->key_data = kd;
- if (GNUNET_TIME_absolute_is_past (exchange->key_data.last_denom_issue_date))
+ if (GNUNET_TIME_absolute_is_past (
+ exchange->key_data.last_denom_issue_date.abs_time))
TALER_LOG_WARNING ("Last DK issue date from exchange is in the past: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
else
TALER_LOG_DEBUG ("Last DK issue date updated to: %s\n",
- GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
@@ -1340,7 +1343,7 @@ TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
*/
static enum GNUNET_GenericReturnValue
parse_date_string (const char *dateline,
- struct GNUNET_TIME_Absolute *at)
+ struct GNUNET_TIME_Timestamp *at)
{
static const char *MONTHS[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
@@ -1422,7 +1425,7 @@ parse_date_string (const char *dateline,
}
if (t < 0)
t = 0; /* can happen due to timezone issues if date was 1.1.1970 */
- at->abs_value_us = 1000LL * 1000LL * t;
+ *at = GNUNET_TIME_timestamp_from_s (t);
return GNUNET_OK;
}
@@ -1464,7 +1467,7 @@ header_cb (char *buffer,
"Failed to parse %s-header `%s'\n",
MHD_HTTP_HEADER_EXPIRES,
val);
- kr->expire = GNUNET_TIME_UNIT_ZERO_ABS;
+ kr->expire = GNUNET_TIME_UNIT_ZERO_TS;
}
GNUNET_free (val);
return total;
@@ -1490,7 +1493,7 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
json_t *keys;
const char *url;
uint32_t version;
- struct GNUNET_TIME_Absolute expire;
+ struct GNUNET_TIME_Timestamp expire;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint32 ("version",
&version),
@@ -1498,8 +1501,8 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
&keys),
GNUNET_JSON_spec_string ("exchange_url",
&url),
- TALER_JSON_spec_absolute_time ("expire",
- &expire),
+ GNUNET_JSON_spec_timestamp ("expire",
+ &expire),
GNUNET_JSON_spec_end ()
};
struct TALER_EXCHANGE_Keys key_data;
@@ -1566,13 +1569,13 @@ json_t *
TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
{
const struct TALER_EXCHANGE_Keys *kd = &exchange->key_data;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
json_t *keys;
json_t *signkeys;
json_t *denoms;
json_t *auditors;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
signkeys = json_array ();
if (NULL == signkeys)
{
@@ -1584,19 +1587,21 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
const struct TALER_EXCHANGE_SigningPublicKey *sk = &kd->sign_keys[i];
json_t *signkey;
- if (now.abs_value_us > sk->valid_until.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now,
+ >,
+ sk->valid_until))
continue; /* skip keys that have expired */
signkey = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("key",
&sk->key),
GNUNET_JSON_pack_data_auto ("master_sig",
&sk->master_sig),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- sk->valid_from),
- GNUNET_JSON_pack_time_abs ("stamp_expire",
- sk->valid_until),
- GNUNET_JSON_pack_time_abs ("stamp_end",
- sk->valid_legal));
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ sk->valid_from),
+ GNUNET_JSON_pack_timestamp ("stamp_expire",
+ sk->valid_until),
+ GNUNET_JSON_pack_timestamp ("stamp_end",
+ sk->valid_legal));
if (NULL == signkey)
{
GNUNET_break (0);
@@ -1623,17 +1628,19 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[i];
json_t *denom;
- if (now.abs_value_us > dk->expire_deposit.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now,
+ >,
+ dk->expire_deposit))
continue; /* skip keys that have expired */
denom = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
- dk->expire_deposit),
- GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
- dk->withdraw_valid_until),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- dk->valid_from),
- GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
- dk->expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
+ dk->expire_deposit),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
+ dk->withdraw_valid_until),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ dk->valid_from),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
+ dk->expire_legal),
TALER_JSON_pack_amount ("value",
&dk->value),
TALER_JSON_pack_amount ("fee_withdraw",
@@ -1677,7 +1684,9 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
&kd->denom_keys[adi->denom_key_offset];
json_t *k;
- if (now.abs_value_us > dk->expire_deposit.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now,
+ >,
+ dk->expire_deposit))
continue; /* skip auditor signatures for denomination keys that have expired */
GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys);
k = GNUNET_JSON_PACK (
@@ -1710,8 +1719,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
&kd->master_pub),
GNUNET_JSON_pack_time_rel ("reserve_closing_delay",
kd->reserve_closing_delay),
- GNUNET_JSON_pack_time_abs ("list_issue_date",
- kd->list_issue_date),
+ GNUNET_JSON_pack_timestamp ("list_issue_date",
+ kd->list_issue_date),
GNUNET_JSON_pack_array_steal ("signkeys",
signkeys),
GNUNET_JSON_pack_array_steal ("denoms",
@@ -1721,8 +1730,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
return GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("version",
EXCHANGE_SERIALIZATION_FORMAT_VERSION),
- GNUNET_JSON_pack_time_abs ("expire",
- exchange->key_data_expiration),
+ GNUNET_JSON_pack_timestamp ("expire",
+ exchange->key_data_expiration),
GNUNET_JSON_pack_string ("exchange_url",
exchange->url),
GNUNET_JSON_pack_object_steal ("keys",
@@ -1823,12 +1832,12 @@ request_keys (void *cls)
if (GNUNET_YES == TEAH_handle_is_ready (exchange))
{
TALER_LOG_DEBUG ("Last DK issue date (before GETting /keys): %s\n",
- GNUNET_STRINGS_absolute_time_to_string (
+ GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
sprintf (&url[strlen (url)],
"last_issue_date=%llu&",
- (unsigned long
- long) exchange->key_data.last_denom_issue_date.abs_value_us
+ (unsigned long long)
+ exchange->key_data.last_denom_issue_date.abs_time.abs_value_us
/ 1000000LLU);
}
@@ -1951,18 +1960,22 @@ TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys,
/* we will check using a tolerance of 1h for the time */
now = GNUNET_TIME_absolute_get ();
for (unsigned int i = 0; i<keys->num_sign_keys; i++)
- if ( (keys->sign_keys[i].valid_from.abs_value_us <=
- GNUNET_TIME_absolute_add (now,
- LIFETIME_TOLERANCE).abs_value_us) &&
- (keys->sign_keys[i].valid_until.abs_value_us >
- GNUNET_TIME_absolute_subtract (now,
- LIFETIME_TOLERANCE).abs_value_us) &&
+ if ( (GNUNET_TIME_absolute_cmp (
+ keys->sign_keys[i].valid_from.abs_time,
+ <=,
+ GNUNET_TIME_absolute_add (now,
+ LIFETIME_TOLERANCE))) &&
+ (GNUNET_TIME_absolute_cmp (
+ keys->sign_keys[i].valid_until.abs_time,
+ >,
+ GNUNET_TIME_absolute_subtract (now,
+ LIFETIME_TOLERANCE))) &&
(0 == GNUNET_memcmp (pub,
&keys->sign_keys[i].key)) )
return GNUNET_OK;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Signing key not valid at time %llu\n",
- (unsigned long long) now.abs_value_us);
+ "Signing key not valid at time %s\n",
+ GNUNET_TIME_absolute2s (now));
return GNUNET_SYSERR;
}
diff --git a/src/lib/exchange_api_handle.h b/src/lib/exchange_api_handle.h
index df0ccf7fc..569c723c4 100644
--- a/src/lib/exchange_api_handle.h
+++ b/src/lib/exchange_api_handle.h
@@ -147,7 +147,7 @@ struct TALER_EXCHANGE_Handle
/**
* When does @e key_data expire?
*/
- struct GNUNET_TIME_Absolute key_data_expiration;
+ struct GNUNET_TIME_Timestamp key_data_expiration;
/**
* Number of subsequent failed requests to /keys.
diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c
index f64dfe4ea..bf7b0bf40 100644
--- a/src/lib/exchange_api_kyc_check.c
+++ b/src/lib/exchange_api_kyc_check.c
@@ -100,8 +100,8 @@ handle_kyc_check_finished (void *cls,
&ks.details.kyc_ok.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&ks.details.kyc_ok.exchange_pub),
- TALER_JSON_spec_absolute_time ("now",
- &ks.details.kyc_ok.timestamp),
+ GNUNET_JSON_spec_timestamp ("now",
+ &ks.details.kyc_ok.timestamp),
GNUNET_JSON_spec_end ()
};
const struct TALER_EXCHANGE_Keys *key_state;
@@ -122,7 +122,7 @@ handle_kyc_check_finished (void *cls,
ks.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
}
- kyc_purpose.timestamp = GNUNET_TIME_absolute_hton (
+ kyc_purpose.timestamp = GNUNET_TIME_timestamp_hton (
ks.details.kyc_ok.timestamp);
key_state = TALER_EXCHANGE_get_keys (kch->exchange);
if (GNUNET_OK !=
diff --git a/src/lib/exchange_api_management_auditor_disable.c b/src/lib/exchange_api_management_auditor_disable.c
index fb68ad6d3..bfe60ee79 100644
--- a/src/lib/exchange_api_management_auditor_disable.c
+++ b/src/lib/exchange_api_management_auditor_disable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -128,7 +129,7 @@ TALER_EXCHANGE_management_disable_auditor (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
void *cb_cls)
@@ -169,9 +170,9 @@ TALER_EXCHANGE_management_disable_auditor (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
- GNUNET_JSON_pack_time_abs ("validity_end",
- validity_end));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_end",
+ validity_end));
+ eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@@ -188,9 +189,6 @@ TALER_EXCHANGE_management_disable_auditor (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_auditor_enable.c b/src/lib/exchange_api_management_auditor_enable.c
index 1f53cb120..a99449307 100644
--- a/src/lib/exchange_api_management_auditor_enable.c
+++ b/src/lib/exchange_api_management_auditor_enable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -127,7 +128,7 @@ TALER_EXCHANGE_management_enable_auditor (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
- struct GNUNET_TIME_Absolute validity_start,
+ struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
void *cb_cls)
@@ -159,9 +160,9 @@ TALER_EXCHANGE_management_enable_auditor (
auditor_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
- GNUNET_JSON_pack_time_abs ("validity_start",
- validity_start));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_start",
+ validity_start));
+ eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@@ -178,9 +179,6 @@ TALER_EXCHANGE_management_enable_auditor (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_get_keys.c b/src/lib/exchange_api_management_get_keys.c
index 5e6024f27..e776082d3 100644
--- a/src/lib/exchange_api_management_get_keys.c
+++ b/src/lib/exchange_api_management_get_keys.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_crypto_lib.h"
@@ -124,12 +125,12 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
&sign_key->key),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
&sign_key->signkey_secmod_sig),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &sign_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire",
- &sign_key->valid_until),
- TALER_JSON_spec_absolute_time ("stamp_end",
- &sign_key->valid_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &sign_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire",
+ &sign_key->valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_end",
+ &sign_key->valid_legal),
GNUNET_JSON_spec_end ()
};
@@ -144,8 +145,8 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
}
{
struct GNUNET_TIME_Relative duration
- = GNUNET_TIME_absolute_get_difference (sign_key->valid_from,
- sign_key->valid_until);
+ = GNUNET_TIME_absolute_get_difference (sign_key->valid_from.abs_time,
+ sign_key->valid_until.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (
@@ -171,14 +172,14 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
- TALER_JSON_spec_absolute_time ("stamp_start",
- &denom_key->valid_from),
- TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
- &denom_key->withdraw_valid_until),
- TALER_JSON_spec_absolute_time ("stamp_expire_deposit",
- &denom_key->expire_deposit),
- TALER_JSON_spec_absolute_time ("stamp_expire_legal",
- &denom_key->expire_legal),
+ GNUNET_JSON_spec_timestamp ("stamp_start",
+ &denom_key->valid_from),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
+ &denom_key->withdraw_valid_until),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
+ &denom_key->expire_deposit),
+ GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
+ &denom_key->expire_legal),
TALER_JSON_spec_denom_pub ("denom_pub",
&denom_key->key),
TALER_JSON_spec_amount_any ("fee_withdraw",
@@ -214,8 +215,9 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
{
struct TALER_DenominationHash h_denom_pub;
struct GNUNET_TIME_Relative duration
- = GNUNET_TIME_absolute_get_difference (denom_key->valid_from,
- denom_key->withdraw_valid_until);
+ = GNUNET_TIME_absolute_get_difference (
+ denom_key->valid_from.abs_time,
+ denom_key->withdraw_valid_until.abs_time);
TALER_denom_pub_hash (&denom_key->key,
&h_denom_pub);
@@ -335,16 +337,6 @@ handle_get_keys_finished (void *cls,
};
-/**
- * Request future keys from the exchange. The obtained information will be
- * passed to the @a cb.
- *
- * @param ctx the context
- * @param url HTTP base URL for the exchange
- * @param cb function to call with the exchange's future keys result
- * @param cb_cls closure for @a cb
- * @return the request handle; NULL upon error
- */
struct TALER_EXCHANGE_ManagementGetKeysHandle *
TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
const char *url,
@@ -368,14 +360,10 @@ TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
GNUNET_free (gh);
return NULL;
}
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (gh->url);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
gh->url);
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_URL,
- gh->url));
gh->job = GNUNET_CURL_job_add (ctx,
eh,
&handle_get_keys_finished,
@@ -389,11 +377,6 @@ TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
}
-/**
- * Cancel #TALER_EXCHANGE_get_management_keys() operation.
- *
- * @param gh handle of the operation to cancel
- */
void
TALER_EXCHANGE_get_management_keys_cancel (
struct TALER_EXCHANGE_ManagementGetKeysHandle *gh)
diff --git a/src/lib/exchange_api_management_post_keys.c b/src/lib/exchange_api_management_post_keys.c
index 6b040bdaa..d7790599a 100644
--- a/src/lib/exchange_api_management_post_keys.c
+++ b/src/lib/exchange_api_management_post_keys.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -189,7 +190,7 @@ TALER_EXCHANGE_post_management_keys (
denom_sigs),
GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sigs));
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ph->post_ctx,
@@ -206,9 +207,6 @@ TALER_EXCHANGE_post_management_keys (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ph->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- ph->url));
ph->job = GNUNET_CURL_job_add2 (ctx,
eh,
ph->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_revoke_denomination_key.c b/src/lib/exchange_api_management_revoke_denomination_key.c
index 4a1a79d03..383d9532e 100644
--- a/src/lib/exchange_api_management_revoke_denomination_key.c
+++ b/src/lib/exchange_api_management_revoke_denomination_key.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -173,7 +174,7 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_free (rh);
return NULL;
}
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx,
eh,
@@ -189,9 +190,6 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
rh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- rh->url));
rh->job = GNUNET_CURL_job_add2 (ctx,
eh,
rh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_revoke_signing_key.c b/src/lib/exchange_api_management_revoke_signing_key.c
index f43a46c40..046d18729 100644
--- a/src/lib/exchange_api_management_revoke_signing_key.c
+++ b/src/lib/exchange_api_management_revoke_signing_key.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -163,7 +164,7 @@ TALER_EXCHANGE_management_revoke_signing_key (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig));
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx,
@@ -180,9 +181,6 @@ TALER_EXCHANGE_management_revoke_signing_key (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
rh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- rh->url));
rh->job = GNUNET_CURL_job_add2 (ctx,
eh,
rh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_set_wire_fee.c b/src/lib/exchange_api_management_set_wire_fee.c
index 075dbbbba..807c6723a 100644
--- a/src/lib/exchange_api_management_set_wire_fee.c
+++ b/src/lib/exchange_api_management_set_wire_fee.c
@@ -22,6 +22,7 @@
#include "platform.h"
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
+#include "exchange_api_curl_defaults.h"
#include "taler_exchange_service.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
@@ -126,8 +127,8 @@ TALER_EXCHANGE_management_set_wire_fees (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
const char *wire_method,
- struct GNUNET_TIME_Absolute validity_start,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_start,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig,
@@ -157,15 +158,15 @@ TALER_EXCHANGE_management_set_wire_fees (
wire_method),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
- GNUNET_JSON_pack_time_abs ("fee_start",
- validity_start),
- GNUNET_JSON_pack_time_abs ("fee_end",
- validity_end),
+ GNUNET_JSON_pack_timestamp ("fee_start",
+ validity_start),
+ GNUNET_JSON_pack_timestamp ("fee_end",
+ validity_end),
TALER_JSON_pack_amount ("closing_fee",
closing_fee),
TALER_JSON_pack_amount ("wire_fee",
wire_fee));
- eh = curl_easy_init ();
+ eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&swfh->post_ctx,
@@ -182,9 +183,6 @@ TALER_EXCHANGE_management_set_wire_fees (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
swfh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- swfh->url));
swfh->job = GNUNET_CURL_job_add2 (ctx,
eh,
swfh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_wire_disable.c b/src/lib/exchange_api_management_wire_disable.c
index fbc6626ad..3bae8e3ab 100644
--- a/src/lib/exchange_api_management_wire_disable.c
+++ b/src/lib/exchange_api_management_wire_disable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -131,7 +132,7 @@ TALER_EXCHANGE_management_disable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
- struct GNUNET_TIME_Absolute validity_end,
+ struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementWireDisableCallback cb,
void *cb_cls)
@@ -159,9 +160,9 @@ TALER_EXCHANGE_management_disable_wire (
payto_uri),
GNUNET_JSON_pack_data_auto ("master_sig_del",
master_sig),
- GNUNET_JSON_pack_time_abs ("validity_end",
- validity_end));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_end",
+ validity_end));
+ eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx,
@@ -178,9 +179,6 @@ TALER_EXCHANGE_management_disable_wire (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
wh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- wh->url));
wh->job = GNUNET_CURL_job_add2 (ctx,
eh,
wh->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_wire_enable.c b/src/lib/exchange_api_management_wire_enable.c
index 43eb2ce97..c4d5b13b4 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_management_wire_enable.c
@@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
+#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@@ -127,7 +128,7 @@ TALER_EXCHANGE_management_enable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
- struct GNUNET_TIME_Absolute validity_start,
+ struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig1,
const struct TALER_MasterSignatureP *master_sig2,
TALER_EXCHANGE_ManagementWireEnableCallback cb,
@@ -158,9 +159,9 @@ TALER_EXCHANGE_management_enable_wire (
master_sig1),
GNUNET_JSON_pack_data_auto ("master_sig_wire",
master_sig2),
- GNUNET_JSON_pack_time_abs ("validity_start",
- validity_start));
- eh = curl_easy_init ();
+ GNUNET_JSON_pack_timestamp ("validity_start",
+ validity_start));
+ eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx,
@@ -177,9 +178,6 @@ TALER_EXCHANGE_management_enable_wire (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
wh->url);
- GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
- CURLOPT_URL,
- wh->url));
wh->job = GNUNET_CURL_job_add2 (ctx,
eh,
wh->post_ctx.headers,
diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c
index d61e7eff4..92b59f4b0 100644
--- a/src/lib/exchange_api_recoup.c
+++ b/src/lib/exchange_api_recoup.c
@@ -305,6 +305,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_Amount *amount,
bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls)
@@ -336,6 +337,8 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
&h_denom_pub),
TALER_JSON_pack_denom_sig ("denom_sig",
denom_sig),
+ TALER_JSON_pack_amount ("amount",
+ amount),
GNUNET_JSON_pack_data_auto ("coin_sig",
&coin_sig),
GNUNET_JSON_pack_data_auto ("coin_blind_key_secret",
diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c
index 4f2a2cf18..3e367566d 100644
--- a/src/lib/exchange_api_refresh_common.c
+++ b/src/lib/exchange_api_refresh_common.c
@@ -89,8 +89,8 @@ serialize_melted_coin (const struct MeltedCoin *mc)
&mc->original_value),
TALER_JSON_pack_amount ("melt_fee",
&mc->fee_melt),
- GNUNET_JSON_pack_time_abs ("expire_deposit",
- mc->expire_deposit),
+ GNUNET_JSON_pack_timestamp ("expire_deposit",
+ mc->expire_deposit),
GNUNET_JSON_pack_array_steal ("transfer_privs",
tprivs));
}
@@ -126,8 +126,8 @@ deserialize_melted_coin (struct MeltedCoin *mc,
TALER_JSON_spec_amount ("melt_fee",
currency,
&mc->fee_melt),
- TALER_JSON_spec_absolute_time ("expire_deposit",
- &mc->expire_deposit),
+ GNUNET_JSON_spec_timestamp ("expire_deposit",
+ &mc->expire_deposit),
GNUNET_JSON_spec_json ("transfer_privs",
&trans_privs),
GNUNET_JSON_spec_end ()
diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h
index 7b531e701..1c037d966 100644
--- a/src/lib/exchange_api_refresh_common.h
+++ b/src/lib/exchange_api_refresh_common.h
@@ -60,7 +60,7 @@ struct MeltedCoin
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
- struct GNUNET_TIME_Absolute expire_deposit;
+ struct GNUNET_TIME_Timestamp expire_deposit;
/**
* Denomination key of the original coin.
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 6e9d416df..a3030e6cf 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -203,9 +203,9 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
struct TALER_PrivateContractHash h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME!
struct TALER_DenominationHash h_denom_pub;
- struct GNUNET_TIME_Absolute wallet_timestamp;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
@@ -216,10 +216,10 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub),
- TALER_JSON_spec_absolute_time ("timestamp",
- &wallet_timestamp),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &wallet_timestamp),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline),
TALER_JSON_spec_amount_any ("deposit_fee",
&deposit_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c
index 87d654c05..b9a9db941 100644
--- a/src/lib/exchange_api_transfers_get.c
+++ b/src/lib/exchange_api_transfers_get.c
@@ -93,7 +93,7 @@ check_transfers_get_response_ok (
TALER_JSON_spec_amount_any ("wire_fee", &td.wire_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_payto", &td.h_payto),
- TALER_JSON_spec_absolute_time ("execution_time", &td.execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time", &td.execution_time),
GNUNET_JSON_spec_json ("deposits", &details_j),
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &td.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &td.exchange_pub),
@@ -181,7 +181,7 @@ check_transfers_get_response_ok (
struct TALER_WireDepositDetailP dd;
dd.h_contract_terms = detail->h_contract_terms;
- dd.execution_time = GNUNET_TIME_absolute_hton (td.execution_time);
+ dd.execution_time = GNUNET_TIME_timestamp_hton (td.execution_time);
dd.coin_pub = detail->coin_pub;
TALER_amount_hton (&dd.deposit_value,
&detail->coin_value);
diff --git a/src/lib/exchange_api_wire.c b/src/lib/exchange_api_wire.c
index 65d38b12a..453b576b1 100644
--- a/src/lib/exchange_api_wire.c
+++ b/src/lib/exchange_api_wire.c
@@ -147,10 +147,10 @@ parse_fees (json_t *fees)
&wa->wire_fee),
TALER_JSON_spec_amount_any ("closing_fee",
&wa->closing_fee),
- TALER_JSON_spec_absolute_time ("start_date",
- &wa->start_date),
- TALER_JSON_spec_absolute_time ("end_date",
- &wa->end_date),
+ GNUNET_JSON_spec_timestamp ("start_date",
+ &wa->start_date),
+ GNUNET_JSON_spec_timestamp ("end_date",
+ &wa->end_date),
GNUNET_JSON_spec_end ()
};
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 78c8af979..37d7bf5be 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -474,123 +474,4 @@ TALER_PQ_query_param_json (const json_t *x)
}
-/**
- * Function called to convert input argument into SQL parameters.
- *
- * @param cls closure
- * @param data pointer to input argument
- * @param data_len number of bytes in @a data (if applicable)
- * @param[out] param_values SQL data to set
- * @param[out] param_lengths SQL length data to set
- * @param[out] param_formats SQL format data to set
- * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
- * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
- * @param scratch_length number of entries left in @a scratch
- * @return -1 on error, number of offsets used in @a scratch otherwise
- */
-static int
-qconv_round_time (void *cls,
- const void *data,
- size_t data_len,
- void *param_values[],
- int param_lengths[],
- int param_formats[],
- unsigned int param_length,
- void *scratch[],
- unsigned int scratch_length)
-{
- const struct GNUNET_TIME_Absolute *at = data;
- struct GNUNET_TIME_Absolute tmp;
- struct GNUNET_TIME_AbsoluteNBO *buf;
-
- (void) cls;
- GNUNET_assert (1 == param_length);
- GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
- GNUNET_assert (scratch_length > 0);
- GNUNET_break (NULL == cls);
- tmp = *at;
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- buf = GNUNET_new (struct GNUNET_TIME_AbsoluteNBO);
- *buf = GNUNET_TIME_absolute_hton (tmp);
- scratch[0] = buf;
- param_values[0] = (void *) buf;
- param_lengths[0] = sizeof (struct GNUNET_TIME_AbsoluteNBO);
- param_formats[0] = 1;
- return 1;
-}
-
-
-struct GNUNET_PQ_QueryParam
-TALER_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
-{
- struct GNUNET_PQ_QueryParam res = {
- .conv = &qconv_round_time,
- .data = x,
- .size = sizeof (*x),
- .num_params = 1
- };
-
- return res;
-}
-
-
-/**
- * Function called to convert input argument into SQL parameters.
- *
- * @param cls closure
- * @param data pointer to input argument
- * @param data_len number of bytes in @a data (if applicable)
- * @param[out] param_values SQL data to set
- * @param[out] param_lengths SQL length data to set
- * @param[out] param_formats SQL format data to set
- * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
- * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
- * @param scratch_length number of entries left in @a scratch
- * @return -1 on error, number of offsets used in @a scratch otherwise
- */
-static int
-qconv_round_time_abs (void *cls,
- const void *data,
- size_t data_len,
- void *param_values[],
- int param_lengths[],
- int param_formats[],
- unsigned int param_length,
- void *scratch[],
- unsigned int scratch_length)
-{
- const struct GNUNET_TIME_AbsoluteNBO *at = data;
- struct GNUNET_TIME_Absolute tmp;
-
- (void) cls;
- (void) scratch;
- (void) scratch_length;
- GNUNET_assert (1 == param_length);
- GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
- GNUNET_break (NULL == cls);
- tmp = GNUNET_TIME_absolute_ntoh (*at);
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- param_values[0] = (void *) at;
- param_lengths[0] = sizeof (struct GNUNET_TIME_AbsoluteNBO);
- param_formats[0] = 1;
- return 0;
-}
-
-
-struct GNUNET_PQ_QueryParam
-TALER_PQ_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x)
-{
- struct GNUNET_PQ_QueryParam res = {
- .conv = &qconv_round_time_abs,
- .data = x,
- .size = sizeof (*x),
- .num_params = 1
- };
-
- return res;
-}
-
-
/* end of pq/pq_query_helper.c */
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 8c9f817b0..a6bc9409a 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -357,146 +357,6 @@ TALER_PQ_result_spec_json (const char *name,
*
* @param cls closure
* @param result where to extract data from
- * @param row the row to extract data from
- * @param fname name (or prefix) of the fields to extract from
- * @param[in,out] dst_size where to store size of result, may be NULL
- * @param[out] dst where to store the result
- * @return
- * #GNUNET_YES if all results could be extracted
- * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
- */
-static enum GNUNET_GenericReturnValue
-extract_round_time (void *cls,
- PGresult *result,
- int row,
- const char *fname,
- size_t *dst_size,
- void *dst)
-{
- struct GNUNET_TIME_Absolute *udst = dst;
- const struct GNUNET_TIME_AbsoluteNBO *res;
- struct GNUNET_TIME_Absolute tmp;
- int fnum;
-
- (void) cls;
- fnum = PQfnumber (result,
- fname);
- if (fnum < 0)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- if (PQgetisnull (result,
- row,
- fnum))
- return GNUNET_NO;
- GNUNET_assert (NULL != dst);
- if (sizeof (struct GNUNET_TIME_Absolute) != *dst_size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- res = (struct GNUNET_TIME_AbsoluteNBO *) PQgetvalue (result,
- row,
- fnum);
- tmp = GNUNET_TIME_absolute_ntoh (*res);
- GNUNET_break (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- *udst = tmp;
- return GNUNET_OK;
-}
-
-
-struct GNUNET_PQ_ResultSpec
-TALER_PQ_result_spec_absolute_time (const char *name,
- struct GNUNET_TIME_Absolute *at)
-{
- struct GNUNET_PQ_ResultSpec res = {
- .conv = &extract_round_time,
- .dst = (void *) at,
- .dst_size = sizeof (struct GNUNET_TIME_Absolute),
- .fname = name
- };
-
- return res;
-}
-
-
-/**
- * Extract data from a Postgres database @a result at row @a row.
- *
- * @param cls closure
- * @param result where to extract data from
- * @param row the row to extract data from
- * @param fname name (or prefix) of the fields to extract from
- * @param[in,out] dst_size where to store size of result, may be NULL
- * @param[out] dst where to store the result
- * @return
- * #GNUNET_YES if all results could be extracted
- * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
- */
-static enum GNUNET_GenericReturnValue
-extract_round_time_nbo (void *cls,
- PGresult *result,
- int row,
- const char *fname,
- size_t *dst_size,
- void *dst)
-{
- struct GNUNET_TIME_AbsoluteNBO *udst = dst;
- const struct GNUNET_TIME_AbsoluteNBO *res;
- struct GNUNET_TIME_Absolute tmp;
- int fnum;
-
- (void) cls;
- fnum = PQfnumber (result,
- fname);
- if (fnum < 0)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- if (PQgetisnull (result,
- row,
- fnum))
- return GNUNET_NO;
- GNUNET_assert (NULL != dst);
- if (sizeof (struct GNUNET_TIME_AbsoluteNBO) != *dst_size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- res = (struct GNUNET_TIME_AbsoluteNBO *) PQgetvalue (result,
- row,
- fnum);
- tmp = GNUNET_TIME_absolute_ntoh (*res);
- GNUNET_break (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- *udst = GNUNET_TIME_absolute_hton (tmp);
- return GNUNET_OK;
-}
-
-
-struct GNUNET_PQ_ResultSpec
-TALER_PQ_result_spec_absolute_time_nbo (const char *name,
- struct GNUNET_TIME_AbsoluteNBO *at)
-{
- struct GNUNET_PQ_ResultSpec res = {
- .conv = &extract_round_time_nbo,
- .dst = (void *) at,
- .dst_size = sizeof (struct GNUNET_TIME_AbsoluteNBO),
- .fname = name
- };
-
- return res;
-}
-
-
-/**
- * Extract data from a Postgres database @a result at row @a row.
- *
- * @param cls closure
- * @param result where to extract data from
* @param int row to extract data from
* @param fname name (or prefix) of the fields to extract from
* @param[in,out] dst_size where to store size of result, may be NULL
diff --git a/src/sq/sq_query_helper.c b/src/sq/sq_query_helper.c
index ad5207e27..d4b2d060d 100644
--- a/src/sq/sq_query_helper.c
+++ b/src/sq/sq_query_helper.c
@@ -36,7 +36,7 @@
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
qconv_amount (void *cls,
const void *data,
size_t data_len,
@@ -59,18 +59,16 @@ qconv_amount (void *cls,
}
-/**
- * Generate query parameter for a currency, consisting of the
- * components "value", "fraction" in this order. The
- * types must be a 64-bit integer and a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_amount (const struct TALER_Amount *x)
{
- struct GNUNET_SQ_QueryParam res =
- { &qconv_amount, NULL, x, sizeof (*x), 2 };
+ struct GNUNET_SQ_QueryParam res = {
+ .conv = &qconv_amount,
+ .data = x,
+ .size = sizeof (*x),
+ .num_params = 2
+ };
+
return res;
}
@@ -86,7 +84,7 @@ TALER_SQ_query_param_amount (const struct TALER_Amount *x)
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
qconv_amount_nbo (void *cls,
const void *data,
size_t data_len,
@@ -108,18 +106,16 @@ qconv_amount_nbo (void *cls,
}
-/**
- * Generate query parameter for a currency, consisting of the
- * components "value", "fraction" in this order. The
- * types must be a 64-bit integer and a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_amount_nbo (const struct TALER_AmountNBO *x)
{
- struct GNUNET_SQ_QueryParam res =
- { &qconv_amount_nbo, NULL, x, sizeof (*x), 2 };
+ struct GNUNET_SQ_QueryParam res = {
+ .conv = &qconv_amount_nbo,
+ .data = x,
+ .size = sizeof (*x),
+ .num_params = 2
+ };
+
return res;
}
@@ -135,7 +131,7 @@ TALER_SQ_query_param_amount_nbo (const struct TALER_AmountNBO *x)
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
-static int
+static enum GNUNET_GenericReturnValue
qconv_json (void *cls,
const void *data,
size_t data_len,
@@ -162,126 +158,16 @@ qconv_json (void *cls,
}
-/**
- * Generate query parameter for a JSON object (stored as a string
- * in the DB). Note that @a x must really be a JSON object or array,
- * passing just a value (string, integer) is not supported and will
- * result in an abort.
- *
- * @param x pointer to the json object to pass
- */
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_json (const json_t *x)
{
- struct GNUNET_SQ_QueryParam res =
- { &qconv_json, NULL, x, sizeof (*x), 1 };
- return res;
-}
-
-
-/**
- * Function called to convert input argument into SQL parameters.
- *
- * @param cls closure
- * @param data pointer to input argument, here a `struct TALER_Amount`
- * @param data_len number of bytes in @a data (if applicable)
- * @param stmt sqlite statement to parameters for
- * @param off offset of the argument to bind in @a stmt, numbered from 1,
- * so immediately suitable for passing to `sqlite3_bind`-functions.
- * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
- */
-static int
-qconv_round_time (void *cls,
- const void *data,
- size_t data_len,
- sqlite3_stmt *stmt,
- unsigned int off)
-{
- const struct GNUNET_TIME_Absolute *at = data;
- struct GNUNET_TIME_Absolute tmp;
-
- (void) cls;
- GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
- GNUNET_break (NULL == cls);
- tmp = *at;
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- if (SQLITE_OK != sqlite3_bind_int64 (stmt,
- (int) off,
- (sqlite3_int64) at->abs_value_us))
- return GNUNET_SYSERR;
- return GNUNET_OK;
-}
-
-
-/**
- * Generate query parameter for an absolute time value.
- * In contrast to
- * #GNUNET_SQ_query_param_absolute_time(), this function
- * will abort (!) if the time given is not rounded!
- * The database must store a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
-struct GNUNET_SQ_QueryParam
-TALER_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
-{
- struct GNUNET_SQ_QueryParam res =
- { &qconv_round_time, NULL, x, sizeof (*x), 1 };
- return res;
-}
+ struct GNUNET_SQ_QueryParam res = {
+ .conv = &qconv_json,
+ .data = x,
+ .size = sizeof (*x),
+ .num_params = 1
+ };
-
-/**
- * Function called to convert input argument into SQL parameters.
- *
- * @param cls closure
- * @param data pointer to input argument, here a `struct TALER_Amount`
- * @param data_len number of bytes in @a data (if applicable)
- * @param stmt sqlite statement to parameters for
- * @param off offset of the argument to bind in @a stmt, numbered from 1,
- * so immediately suitable for passing to `sqlite3_bind`-functions.
- * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
- */
-static int
-qconv_round_time_abs (void *cls,
- const void *data,
- size_t data_len,
- sqlite3_stmt *stmt,
- unsigned int off)
-{
- const struct GNUNET_TIME_AbsoluteNBO *at = data;
- struct GNUNET_TIME_Absolute tmp;
-
- (void) cls;
- GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
- GNUNET_break (NULL == cls);
- tmp = GNUNET_TIME_absolute_ntoh (*at);
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- if (SQLITE_OK != sqlite3_bind_int64 (stmt,
- (int) off,
- (sqlite3_int64) tmp.abs_value_us))
- return GNUNET_SYSERR;
- return GNUNET_OK;
-}
-
-
-/**
- * Generate query parameter for an absolute time value.
- * In contrast to
- * #GNUNET_SQ_query_param_absolute_time(), this function
- * will abort (!) if the time given is not rounded!
- * The database must store a 64-bit integer.
- *
- * @param x pointer to the query parameter to pass
- */
-struct GNUNET_SQ_QueryParam
-TALER_SQ_query_param_absolute_time_nbo (const struct
- GNUNET_TIME_AbsoluteNBO *x)
-{
- struct GNUNET_SQ_QueryParam res =
- { &qconv_round_time_abs, NULL, x, sizeof (*x), 1 };
return res;
}
diff --git a/src/sq/sq_result_helper.c b/src/sq/sq_result_helper.c
index 7cd8e80b4..bacb7743a 100644
--- a/src/sq/sq_result_helper.c
+++ b/src/sq/sq_result_helper.c
@@ -38,7 +38,7 @@
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_amount (void *cls,
sqlite3_stmt *result,
unsigned int column,
@@ -68,13 +68,6 @@ extract_amount (void *cls,
}
-/**
- * Currency amount expected.
- *
- * @param currency the currency to use for @a amount
- * @param[out] amount where to store the result
- * @return array entry for the result specification to use
- */
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_amount (const char *currency,
struct TALER_Amount *amount)
@@ -103,7 +96,7 @@ TALER_SQ_result_spec_amount (const char *currency,
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_amount_nbo (void *cls,
sqlite3_stmt *result,
unsigned int column,
@@ -132,13 +125,6 @@ extract_amount_nbo (void *cls,
}
-/**
- * Currency amount expected.
- *
- * @param currency the currency to use for @a amount
- * @param[out] amount where to store the result
- * @return array entry for the result specification to use
- */
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_amount_nbo (const char *currency,
struct TALER_AmountNBO *amount)
@@ -167,7 +153,7 @@ TALER_SQ_result_spec_amount_nbo (const char *currency,
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_json (void *cls,
sqlite3_stmt *result,
unsigned int column,
@@ -248,138 +234,4 @@ TALER_SQ_result_spec_json (json_t **jp)
}
-/**
- * Extract amount data from a SQLite database
- *
- * @param cls closure
- * @param result where to extract data from
- * @param column column to extract data from
- * @param[in,out] dst_size where to store size of result, may be NULL
- * @param[out] dst where to store the result
- * @return
- * #GNUNET_YES if all results could be extracted
- * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
- */
-static int
-extract_round_time (void *cls,
- sqlite3_stmt *result,
- unsigned int column,
- size_t *dst_size,
- void *dst)
-{
- struct GNUNET_TIME_Absolute *udst = dst;
- struct GNUNET_TIME_Absolute tmp;
-
- (void) cls;
- if (SQLITE_INTEGER != sqlite3_column_type (result,
- (int) column))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- GNUNET_assert (NULL != dst);
- if (sizeof (struct GNUNET_TIME_Absolute) != *dst_size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- tmp.abs_value_us = sqlite3_column_int64 (result,
- (int) column);
- GNUNET_break (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- *udst = tmp;
- return GNUNET_OK;
-}
-
-
-/**
- * Rounded absolute time expected.
- * In contrast to #GNUNET_SQ_query_param_absolute_time_nbo(),
- * this function ensures that the result is rounded and can
- * be converted to JSON.
- *
- * @param[out] at where to store the result
- * @return array entry for the result specification to use
- */
-struct GNUNET_SQ_ResultSpec
-TALER_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
-{
- struct GNUNET_SQ_ResultSpec res = {
- .conv = &extract_round_time,
- .dst = (void *) at,
- .dst_size = sizeof (struct GNUNET_TIME_Absolute),
- .num_params = 1
- };
-
- return res;
-}
-
-
-/**
- * Extract amount data from a SQLite database
- *
- * @param cls closure
- * @param result where to extract data from
- * @param column column to extract data from
- * @param[in,out] dst_size where to store size of result, may be NULL
- * @param[out] dst where to store the result
- * @return
- * #GNUNET_YES if all results could be extracted
- * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
- */
-static int
-extract_round_time_nbo (void *cls,
- sqlite3_stmt *result,
- unsigned int column,
- size_t *dst_size,
- void *dst)
-{
- struct GNUNET_TIME_AbsoluteNBO *udst = dst;
- struct GNUNET_TIME_Absolute tmp;
-
- (void) cls;
- if (SQLITE_INTEGER != sqlite3_column_type (result,
- (int) column))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- GNUNET_assert (NULL != dst);
- if (sizeof (struct GNUNET_TIME_AbsoluteNBO) != *dst_size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- tmp.abs_value_us = sqlite3_column_int64 (result,
- (int) column);
- GNUNET_break (GNUNET_OK ==
- GNUNET_TIME_round_abs (&tmp));
- *udst = GNUNET_TIME_absolute_hton (tmp);
- return GNUNET_OK;
-}
-
-
-/**
- * Rounded absolute time expected.
- * In contrast to #GNUNET_SQ_result_spec_absolute_time_nbo(),
- * this function ensures that the result is rounded and can
- * be converted to JSON.
- *
- * @param[out] at where to store the result
- * @return array entry for the result specification to use
- */
-struct GNUNET_SQ_ResultSpec
-TALER_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
-{
- struct GNUNET_SQ_ResultSpec res = {
- .conv = &extract_round_time_nbo,
- .dst = (void *) at,
- .dst_size = sizeof (struct GNUNET_TIME_AbsoluteNBO),
- .num_params = 1
- };
-
- return res;
-}
-
-
/* end of sq/sq_result_helper.c */
diff --git a/src/testing/test_taler_exchange_aggregator.c b/src/testing/test_taler_exchange_aggregator.c
index 684fe9697..bf28375b2 100644
--- a/src/testing/test_taler_exchange_aggregator.c
+++ b/src/testing/test_taler_exchange_aggregator.c
@@ -111,7 +111,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -130,7 +130,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -139,7 +139,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -159,7 +159,7 @@ run (void *cls,
&dbc,
"bob",
"4",
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -167,7 +167,7 @@ run (void *cls,
&dbc,
"bob",
"5",
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -175,7 +175,7 @@ run (void *cls,
&dbc,
"alice",
"4",
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -204,7 +204,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -214,7 +214,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -240,7 +240,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
10),
@@ -251,7 +251,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -276,7 +276,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -288,7 +288,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -296,7 +296,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -308,7 +308,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -320,7 +320,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.112",
"EUR:0.1"),
@@ -337,7 +337,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.109",
"EUR:0.1"),
@@ -349,7 +349,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.119",
"EUR:0.1"),
@@ -366,7 +366,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.122",
"EUR:0.1"),
@@ -383,7 +383,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -397,7 +397,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -413,7 +413,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.122",
"EUR:0.1"),
@@ -430,7 +430,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -444,7 +444,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -460,7 +460,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.112",
"EUR:0.1"),
diff --git a/src/testing/testing_api_cmd_auditor_add.c b/src/testing/testing_api_cmd_auditor_add.c
index e40e13194..8362b66c9 100644
--- a/src/testing/testing_api_cmd_auditor_add.c
+++ b/src/testing/testing_api_cmd_auditor_add.c
@@ -102,12 +102,11 @@ auditor_add_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct AuditorAddState *ds = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct TALER_MasterSignatureP master_sig;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_cmd_auditor_del.c b/src/testing/testing_api_cmd_auditor_del.c
index dc31b72b6..de03d1632 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_auditor_del.c
@@ -103,11 +103,10 @@ auditor_del_run (void *cls,
{
struct AuditorDelState *ds = cls;
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
index df32b352b..debf343cc 100644
--- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
+++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
@@ -204,11 +204,11 @@ deposit_confirmation_run (void *cls,
const struct TALER_TESTING_Command *deposit_cmd;
struct TALER_MerchantWireHash h_wire;
struct TALER_PrivateContractHash h_contract_terms;
- const struct GNUNET_TIME_Absolute *exchange_timestamp = NULL;
- struct GNUNET_TIME_Absolute timestamp;
- const struct GNUNET_TIME_Absolute *wire_deadline;
- struct GNUNET_TIME_Absolute refund_deadline
- = GNUNET_TIME_UNIT_ZERO_ABS;
+ const struct GNUNET_TIME_Timestamp *exchange_timestamp = NULL;
+ struct GNUNET_TIME_Timestamp timestamp;
+ const struct GNUNET_TIME_Timestamp *wire_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline
+ = GNUNET_TIME_UNIT_ZERO_TS;
struct TALER_Amount amount_without_fee;
struct TALER_CoinSpendPublicKeyP coin_pub;
const struct TALER_MerchantPrivateKeyP *merchant_priv;
@@ -243,9 +243,9 @@ deposit_confirmation_run (void *cls,
dcs->coin_index,
&exchange_sig));
GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_absolute_time (deposit_cmd,
- dcs->coin_index,
- &exchange_timestamp));
+ TALER_TESTING_get_trait_timestamp (deposit_cmd,
+ dcs->coin_index,
+ &exchange_timestamp));
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_wire_deadline (deposit_cmd,
dcs->coin_index,
@@ -287,11 +287,11 @@ deposit_confirmation_run (void *cls,
{
struct GNUNET_JSON_Specification spec[] = {
/* timestamp is mandatory */
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline)),
GNUNET_JSON_spec_end ()
};
@@ -304,7 +304,7 @@ deposit_confirmation_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- if (0 == refund_deadline.abs_value_us)
+ if (GNUNET_TIME_absolute_is_zero (refund_deadline.abs_time))
refund_deadline = timestamp;
}
dcs->dc = TALER_AUDITOR_deposit_confirmation (dcs->auditor,
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index 58089f429..64e010efa 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -117,7 +117,7 @@ struct AdminAddIncomingState
/**
* Timestamp of the transaction (as returned from the bank).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Merchant instance. Sometimes used to get the tip reserve
@@ -207,7 +207,7 @@ confirmation_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const json_t *json)
{
struct AdminAddIncomingState *fts = cls;
@@ -432,7 +432,7 @@ admin_add_incoming_traits (void *cls,
TALER_TESTING_make_trait_exchange_bank_account_url (
&fts->exchange_credit_url),
TALER_TESTING_make_trait_amount (&fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_timestamp (0, &fts->timestamp),
TALER_TESTING_make_trait_reserve_priv (&fts->reserve_priv),
TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
TALER_TESTING_make_trait_reserve_history (&fts->reserve_history),
@@ -454,7 +454,7 @@ admin_add_incoming_traits (void *cls,
TALER_TESTING_make_trait_exchange_bank_account_url (
&fts->exchange_credit_url),
TALER_TESTING_make_trait_amount (&fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_timestamp (0, &fts->timestamp),
TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
TALER_TESTING_make_trait_reserve_history (&fts->reserve_history),
TALER_TESTING_trait_end ()
diff --git a/src/testing/testing_api_cmd_bank_transfer.c b/src/testing/testing_api_cmd_bank_transfer.c
index 0755a71d2..8c14aac19 100644
--- a/src/testing/testing_api_cmd_bank_transfer.c
+++ b/src/testing/testing_api_cmd_bank_transfer.c
@@ -97,7 +97,7 @@ struct TransferState
/**
* Timestamp of the transaction (as returned from the bank).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Configuration filename. Used to get the tip reserve key
@@ -175,7 +175,7 @@ confirmation_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct TransferState *fts = cls;
struct TALER_TESTING_Interpreter *is = fts->is;
@@ -326,7 +326,7 @@ transfer_traits (void *cls,
TALER_TESTING_make_trait_debit_payto_uri (
(const char **) &fts->payto_debit_account),
TALER_TESTING_make_trait_amount (&fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_timestamp (0, &fts->timestamp),
TALER_TESTING_make_trait_wtid (&fts->wtid),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_check_keys.c b/src/testing/testing_api_cmd_check_keys.c
index 5645bb9be..0dee8be3a 100644
--- a/src/testing/testing_api_cmd_check_keys.c
+++ b/src/testing/testing_api_cmd_check_keys.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2018, 2020 Taler Systems SA
+ (C) 2018, 2020, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -55,7 +55,7 @@ struct CheckKeysState
/**
* Last denomination date we received when doing this request.
*/
- struct GNUNET_TIME_Absolute my_denom_date;
+ struct GNUNET_TIME_Timestamp my_denom_date;
};
@@ -80,7 +80,7 @@ check_keys_run (void *cls,
is->key_generation);
if (is->key_generation < cks->generation)
{
- struct GNUNET_TIME_Absolute rdate;
+ struct GNUNET_TIME_Timestamp rdate;
is->working = GNUNET_NO;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -93,11 +93,11 @@ check_keys_run (void *cls,
{
TALER_LOG_DEBUG ("Forcing last_denom_date URL argument set to zero\n");
TALER_EXCHANGE_set_last_denom (is->exchange,
- GNUNET_TIME_UNIT_ZERO_ABS);
+ GNUNET_TIME_UNIT_ZERO_TS);
}
else
{
- const struct GNUNET_TIME_Absolute *last_denom_date;
+ const struct GNUNET_TIME_Timestamp *last_denom_date;
const struct TALER_TESTING_Command *ref;
ref = TALER_TESTING_interpreter_lookup_command (is,
@@ -109,9 +109,9 @@ check_keys_run (void *cls,
return;
}
if (GNUNET_OK !=
- TALER_TESTING_get_trait_absolute_time (ref,
- 0,
- &last_denom_date))
+ TALER_TESTING_get_trait_timestamp (ref,
+ 0,
+ &last_denom_date))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
@@ -130,8 +130,7 @@ check_keys_run (void *cls,
? TALER_EXCHANGE_CKF_FORCE_ALL_NOW
: TALER_EXCHANGE_CKF_FORCE_DOWNLOAD);
/* Redownload /keys. */
- GNUNET_break (0 ==
- rdate.abs_value_us);
+ GNUNET_break (GNUNET_TIME_absolute_is_zero (rdate.abs_time));
return;
}
{
@@ -186,8 +185,8 @@ check_keys_traits (void *cls,
struct CheckKeysState *cks = cls;
struct TALER_TESTING_Trait traits[] = {
/* history entry MUST be first due to response code logic below! */
- TALER_TESTING_make_trait_absolute_time (0,
- &cks->my_denom_date),
+ TALER_TESTING_make_trait_timestamp (0,
+ &cks->my_denom_date),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index cb6dfc0b2..a0eb35f19 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -82,12 +82,12 @@ struct DepositState
/**
* Refund deadline. Zero for no refunds.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* Wire deadline.
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Set (by the interpreter) to a fresh private key. This
@@ -103,7 +103,7 @@ struct DepositState
/**
* Timestamp of the /deposit operation in the wallet (contract signing time).
*/
- struct GNUNET_TIME_Absolute wallet_timestamp;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
/**
* Interpreter state.
@@ -139,7 +139,7 @@ struct DepositState
/**
* When did the exchange receive the deposit?
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* Signing key used by the exchange to sign the
@@ -402,27 +402,25 @@ deposit_run (void *cls,
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin_pub.eddsa_pub);
- if (0 != ds->refund_deadline.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (ds->refund_deadline.abs_time))
{
struct GNUNET_TIME_Relative refund_deadline;
refund_deadline
- = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline);
+ = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline.abs_time);
ds->wire_deadline
- = GNUNET_TIME_relative_to_absolute (
+ =
+ GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_multiply (refund_deadline,
2));
}
else
{
ds->refund_deadline = ds->wallet_timestamp;
- ds->wire_deadline
- = GNUNET_TIME_relative_to_absolute (
- GNUNET_TIME_UNIT_ZERO);
+ ds->wire_deadline = GNUNET_TIME_timestamp_get ();
}
GNUNET_CRYPTO_eddsa_key_get_public (&ds->merchant_priv.eddsa_priv,
&merchant_pub.eddsa_pub);
- (void) GNUNET_TIME_round_abs (&ds->wire_deadline);
{
struct TALER_MerchantWireHash h_wire;
@@ -562,8 +560,8 @@ deposit_traits (void *cls,
TALER_TESTING_make_trait_merchant_priv (&ds->merchant_priv),
TALER_TESTING_make_trait_deposit_amount (&ds->amount),
TALER_TESTING_make_trait_deposit_fee_amount (&ds->deposit_fee),
- TALER_TESTING_make_trait_absolute_time (0,
- &ds->exchange_timestamp),
+ TALER_TESTING_make_trait_timestamp (0,
+ &ds->exchange_timestamp),
TALER_TESTING_make_trait_wire_deadline (0,
&ds->wire_deadline),
TALER_TESTING_make_trait_refund_deadline (0,
@@ -610,22 +608,19 @@ TALER_TESTING_cmd_deposit (const char *label,
label);
GNUNET_assert (0);
}
- ds->wallet_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&ds->wallet_timestamp);
-
+ ds->wallet_timestamp = GNUNET_TIME_timestamp_get ();
GNUNET_assert (0 ==
json_object_set_new (ds->contract_terms,
"timestamp",
- GNUNET_JSON_from_time_abs (
+ GNUNET_JSON_from_timestamp (
ds->wallet_timestamp)));
- if (0 != refund_deadline.rel_value_us)
+ if (! GNUNET_TIME_relative_is_zero (refund_deadline))
{
- ds->refund_deadline = GNUNET_TIME_relative_to_absolute (refund_deadline);
- (void) GNUNET_TIME_round_abs (&ds->refund_deadline);
+ ds->refund_deadline = GNUNET_TIME_relative_to_timestamp (refund_deadline);
GNUNET_assert (0 ==
json_object_set_new (ds->contract_terms,
"refund_deadline",
- GNUNET_JSON_from_time_abs (
+ GNUNET_JSON_from_timestamp (
ds->refund_deadline)));
}
GNUNET_assert (GNUNET_OK ==
@@ -677,19 +672,16 @@ TALER_TESTING_cmd_deposit_with_ref (const char *label,
label);
GNUNET_assert (0);
}
- ds->wallet_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&ds->wallet_timestamp);
-
+ ds->wallet_timestamp = GNUNET_TIME_timestamp_get ();
json_object_set_new (ds->contract_terms,
"timestamp",
- GNUNET_JSON_from_time_abs (ds->wallet_timestamp));
+ GNUNET_JSON_from_timestamp (ds->wallet_timestamp));
if (0 != refund_deadline.rel_value_us)
{
- ds->refund_deadline = GNUNET_TIME_relative_to_absolute (refund_deadline);
- (void) GNUNET_TIME_round_abs (&ds->refund_deadline);
+ ds->refund_deadline = GNUNET_TIME_relative_to_timestamp (refund_deadline);
json_object_set_new (ds->contract_terms,
"refund_deadline",
- GNUNET_JSON_from_time_abs (ds->refund_deadline));
+ GNUNET_JSON_from_timestamp (ds->refund_deadline));
}
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (amount,
diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c
index 0001da223..276907e14 100644
--- a/src/testing/testing_api_cmd_insert_deposit.c
+++ b/src/testing/testing_api_cmd_insert_deposit.c
@@ -60,7 +60,7 @@ struct InsertDepositState
/**
* When did the exchange receive the deposit?
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* Amount to deposit, inclusive of deposit fee.
@@ -81,27 +81,23 @@ struct InsertDepositState
static void
fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
memset (issue,
0,
sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP));
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
issue->properties.start
- = GNUNET_TIME_absolute_hton (now);
+ = GNUNET_TIME_timestamp_hton (now);
issue->properties.expire_withdraw
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_MINUTES));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES));
issue->properties.expire_deposit
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_HOURS));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_HOURS));
issue->properties.expire_legal
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_DAYS));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_DAYS));
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount_nbo ("EUR:1",
&issue->properties.value));
@@ -235,11 +231,9 @@ insert_deposit_run (void *cls,
memset (&deposit.wire_salt,
46,
sizeof (deposit.wire_salt));
- deposit.timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&deposit.timestamp);
- deposit.wire_deadline = GNUNET_TIME_relative_to_absolute (ids->wire_deadline);
- (void) GNUNET_TIME_round_abs (&deposit.wire_deadline);
-
+ deposit.timestamp = GNUNET_TIME_timestamp_get ();
+ deposit.wire_deadline = GNUNET_TIME_relative_to_timestamp (
+ ids->wire_deadline);
/* finally, actually perform the DB operation */
if ( (GNUNET_OK !=
ids->dbc->plugin->start (ids->dbc->plugin->cls,
@@ -295,14 +289,13 @@ TALER_TESTING_cmd_insert_deposit (
const struct TALER_TESTING_DatabaseConnection *dbc,
const char *merchant_name,
const char *merchant_account,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Relative wire_deadline,
const char *amount_with_fee,
const char *deposit_fee)
{
struct InsertDepositState *ids;
- GNUNET_TIME_round_abs (&exchange_timestamp);
ids = GNUNET_new (struct InsertDepositState);
ids->dbc = dbc;
ids->merchant_name = merchant_name;
diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c
index fe97edb76..379304d01 100644
--- a/src/testing/testing_api_cmd_recoup.c
+++ b/src/testing/testing_api_cmd_recoup.c
@@ -364,6 +364,7 @@ recoup_run (void *cls,
denom_pub,
coin_sig,
&planchet,
+ &ps->reserve_history.amount,
NULL != ps->melt_reference,
recoup_cb,
ps);
@@ -440,10 +441,9 @@ TALER_TESTING_cmd_recoup (const char *label,
ps->expected_response_code = expected_response_code;
ps->coin_reference = coin_reference;
ps->melt_reference = melt_reference;
- if ( (NULL != amount) &&
- (GNUNET_OK !=
- TALER_string_to_amount (amount,
- &ps->reserve_history.amount)) )
+ if (GNUNET_OK !=
+ TALER_string_to_amount (amount,
+ &ps->reserve_history.amount))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to parse amount `%s' at %s\n",
diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c
index 9b5f6258d..b458d10c1 100644
--- a/src/testing/testing_api_cmd_set_wire_fee.c
+++ b/src/testing/testing_api_cmd_set_wire_fee.c
@@ -119,19 +119,20 @@ wire_add_run (void *cls,
struct WireFeeState *ds = cls;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_TIME_Absolute start_time;
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp start_time;
+ struct GNUNET_TIME_Timestamp end_time;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
(void) cmd;
ds->is = is;
now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- start_time = GNUNET_TIME_absolute_subtract (now,
- GNUNET_TIME_UNIT_HOURS);
- end_time = GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_HOURS);
+ start_time = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (now,
+ GNUNET_TIME_UNIT_HOURS));
+ end_time = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (now,
+ GNUNET_TIME_UNIT_HOURS));
if ( (GNUNET_OK !=
TALER_string_to_amount (ds->closing_fee,
&closing_fee)) ||
diff --git a/src/testing/testing_api_cmd_status.c b/src/testing/testing_api_cmd_status.c
index 1424eb6a5..f13f60073 100644
--- a/src/testing/testing_api_cmd_status.c
+++ b/src/testing/testing_api_cmd_status.c
@@ -88,8 +88,9 @@ history_entry_cmp (const struct TALER_EXCHANGE_ReserveHistory *h1,
h2->details.in_details.sender_url)) &&
(h1->details.in_details.wire_reference ==
h2->details.in_details.wire_reference) &&
- (h1->details.in_details.timestamp.abs_value_us ==
- h2->details.in_details.timestamp.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (h1->details.in_details.timestamp,
+ ==,
+ h2->details.in_details.timestamp)) )
return 0;
return 1;
case TALER_EXCHANGE_RTT_WITHDRAWAL:
diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c
index f36eaa85b..c07e9bba6 100644
--- a/src/testing/testing_api_cmd_wire_add.c
+++ b/src/testing/testing_api_cmd_wire_add.c
@@ -109,11 +109,10 @@ wire_add_run (void *cls,
struct WireAddState *ds = cls;
struct TALER_MasterSignatureP master_sig1;
struct TALER_MasterSignatureP master_sig2;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c
index fa8c9bcd2..15d29d727 100644
--- a/src/testing/testing_api_cmd_wire_del.c
+++ b/src/testing/testing_api_cmd_wire_del.c
@@ -108,11 +108,10 @@ wire_del_run (void *cls,
{
struct WireDelState *ds = cls;
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_helpers_exchange.c b/src/testing/testing_api_helpers_exchange.c
index 0f50aabb8..fe7588107 100644
--- a/src/testing/testing_api_helpers_exchange.c
+++ b/src/testing/testing_api_helpers_exchange.c
@@ -422,19 +422,22 @@ const struct TALER_EXCHANGE_DenomPublicKey *
TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_Amount *amount)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct TALER_EXCHANGE_DenomPublicKey *pk;
char *str;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
for (unsigned int i = 0; i<keys->num_denom_keys; i++)
{
pk = &keys->denom_keys[i];
if ( (0 == TALER_amount_cmp (amount,
&pk->value)) &&
- (now.abs_value_us >= pk->valid_from.abs_value_us) &&
- (now.abs_value_us <
- pk->withdraw_valid_until.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (now,
+ >=,
+ pk->valid_from)) &&
+ (GNUNET_TIME_timestamp_cmp (now,
+ <,
+ pk->withdraw_valid_until)) )
return pk;
}
/* do 2nd pass to check if expiration times are to blame for
@@ -445,19 +448,21 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
pk = &keys->denom_keys[i];
if ( (0 == TALER_amount_cmp (amount,
&pk->value)) &&
- ( (now.abs_value_us < pk->valid_from.abs_value_us) ||
- (now.abs_value_us >
- pk->withdraw_valid_until.abs_value_us) ) )
+ (GNUNET_TIME_timestamp_cmp (now,
+ <,
+ pk->valid_from) ||
+ GNUNET_TIME_timestamp_cmp (now,
+ >,
+ pk->withdraw_valid_until) ) )
{
GNUNET_log
(GNUNET_ERROR_TYPE_WARNING,
"Have denomination key for `%s', but with wrong"
" expiration range %llu vs [%llu,%llu)\n",
str,
- (unsigned long long) now.abs_value_us,
- (unsigned long long) pk->valid_from.abs_value_us,
- (unsigned long long)
- pk->withdraw_valid_until.abs_value_us);
+ (unsigned long long) now.abs_time.abs_value_us,
+ (unsigned long long) pk->valid_from.abs_time.abs_value_us,
+ (unsigned long long) pk->withdraw_valid_until.abs_time.abs_value_us);
GNUNET_free (str);
return NULL;
}
diff --git a/src/util/auditor_signatures.c b/src/util/auditor_signatures.c
index 6ca1b046d..7b53c21c1 100644
--- a/src/util/auditor_signatures.c
+++ b/src/util/auditor_signatures.c
@@ -28,10 +28,10 @@ TALER_auditor_denom_validity_sign (
const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -43,10 +43,10 @@ TALER_auditor_denom_validity_sign (
struct TALER_ExchangeKeyValidityPS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS),
.purpose.size = htonl (sizeof (kv)),
- .start = GNUNET_TIME_absolute_hton (stamp_start),
- .expire_withdraw = GNUNET_TIME_absolute_hton (stamp_expire_withdraw),
- .expire_deposit = GNUNET_TIME_absolute_hton (stamp_expire_deposit),
- .expire_legal = GNUNET_TIME_absolute_hton (stamp_expire_legal),
+ .start = GNUNET_TIME_timestamp_hton (stamp_start),
+ .expire_withdraw = GNUNET_TIME_timestamp_hton (stamp_expire_withdraw),
+ .expire_deposit = GNUNET_TIME_timestamp_hton (stamp_expire_deposit),
+ .expire_legal = GNUNET_TIME_timestamp_hton (stamp_expire_legal),
.denom_hash = *h_denom_pub,
.master = *master_pub,
};
@@ -75,10 +75,10 @@ TALER_auditor_denom_validity_verify (
const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -90,10 +90,10 @@ TALER_auditor_denom_validity_verify (
struct TALER_ExchangeKeyValidityPS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS),
.purpose.size = htonl (sizeof (kv)),
- .start = GNUNET_TIME_absolute_hton (stamp_start),
- .expire_withdraw = GNUNET_TIME_absolute_hton (stamp_expire_withdraw),
- .expire_deposit = GNUNET_TIME_absolute_hton (stamp_expire_deposit),
- .expire_legal = GNUNET_TIME_absolute_hton (stamp_expire_legal),
+ .start = GNUNET_TIME_timestamp_hton (stamp_start),
+ .expire_withdraw = GNUNET_TIME_timestamp_hton (stamp_expire_withdraw),
+ .expire_deposit = GNUNET_TIME_timestamp_hton (stamp_expire_deposit),
+ .expire_legal = GNUNET_TIME_timestamp_hton (stamp_expire_legal),
.denom_hash = *h_denom_pub,
.master = *master_pub,
};
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index 702ea74df..5a9ad74e2 100644
--- a/src/util/crypto_helper_esign.c
+++ b/src/util/crypto_helper_esign.c
@@ -182,7 +182,7 @@ handle_mt_avail (struct TALER_CRYPTO_ExchangeSignHelper *esh,
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (
&kan->exchange_pub,
- GNUNET_TIME_absolute_ntoh (kan->anchor_time),
+ GNUNET_TIME_timestamp_ntoh (kan->anchor_time),
GNUNET_TIME_relative_ntoh (kan->duration),
&kan->secm_pub,
&kan->secm_sig))
@@ -191,7 +191,7 @@ handle_mt_avail (struct TALER_CRYPTO_ExchangeSignHelper *esh,
return GNUNET_SYSERR;
}
esh->ekc (esh->ekc_cls,
- GNUNET_TIME_absolute_ntoh (kan->anchor_time),
+ GNUNET_TIME_timestamp_ntoh (kan->anchor_time),
GNUNET_TIME_relative_ntoh (kan->duration),
&kan->exchange_pub,
&kan->secm_pub,
@@ -220,7 +220,7 @@ handle_mt_purge (struct TALER_CRYPTO_ExchangeSignHelper *esh,
return GNUNET_SYSERR;
}
esh->ekc (esh->ekc_cls,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
GNUNET_TIME_UNIT_ZERO,
&pn->exchange_pub,
NULL,
diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c
index 3138ebf3e..fbfc97702 100644
--- a/src/util/crypto_helper_rsa.c
+++ b/src/util/crypto_helper_rsa.c
@@ -225,7 +225,7 @@ handle_mt_avail (struct TALER_CRYPTO_RsaDenominationHelper *dh,
TALER_exchange_secmod_rsa_verify (
&h_rsa,
section_name,
- GNUNET_TIME_absolute_ntoh (kan->anchor_time),
+ GNUNET_TIME_timestamp_ntoh (kan->anchor_time),
GNUNET_TIME_relative_ntoh (kan->duration_withdraw),
&kan->secm_pub,
&kan->secm_sig))
@@ -236,7 +236,7 @@ handle_mt_avail (struct TALER_CRYPTO_RsaDenominationHelper *dh,
}
dh->dkc (dh->dkc_cls,
section_name,
- GNUNET_TIME_absolute_ntoh (kan->anchor_time),
+ GNUNET_TIME_timestamp_ntoh (kan->anchor_time),
GNUNET_TIME_relative_ntoh (kan->duration_withdraw),
&h_rsa,
&denom_pub,
@@ -272,7 +272,7 @@ handle_mt_purge (struct TALER_CRYPTO_RsaDenominationHelper *dh,
GNUNET_h2s (&pn->h_rsa.hash));
dh->dkc (dh->dkc_cls,
NULL,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
GNUNET_TIME_UNIT_ZERO,
&pn->h_rsa,
NULL,
diff --git a/src/util/exchange_signatures.c b/src/util/exchange_signatures.c
index 2e71a33c1..b923c29de 100644
--- a/src/util/exchange_signatures.c
+++ b/src/util/exchange_signatures.c
@@ -28,9 +28,9 @@ TALER_exchange_deposit_confirm_verify (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute wire_deadline,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp wire_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@@ -42,9 +42,9 @@ TALER_exchange_deposit_confirm_verify (
.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS)),
.h_contract_terms = *h_contract_terms,
.h_wire = *h_wire,
- .exchange_timestamp = GNUNET_TIME_absolute_hton (exchange_timestamp),
- .wire_deadline = GNUNET_TIME_absolute_hton (wire_deadline),
- .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
+ .exchange_timestamp = GNUNET_TIME_timestamp_hton (exchange_timestamp),
+ .wire_deadline = GNUNET_TIME_timestamp_hton (wire_deadline),
+ .refund_deadline = GNUNET_TIME_timestamp_hton (refund_deadline),
.coin_pub = *coin_pub,
.merchant_pub = *merchant_pub
};
diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c
index fe502c659..cd9dceca5 100644
--- a/src/util/offline_signatures.c
+++ b/src/util/offline_signatures.c
@@ -27,14 +27,14 @@ void
TALER_exchange_offline_auditor_add_sign (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
- struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig)
{
struct TALER_MasterAddAuditorPS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_AUDITOR),
.purpose.size = htonl (sizeof (kv)),
- .start_date = GNUNET_TIME_absolute_hton (start_date),
+ .start_date = GNUNET_TIME_timestamp_hton (start_date),
.auditor_pub = *auditor_pub,
};
@@ -51,7 +51,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_offline_auditor_add_verify (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
- struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig)
{
@@ -59,7 +59,7 @@ TALER_exchange_offline_auditor_add_verify (
.purpose.purpose = htonl (
TALER_SIGNATURE_MASTER_ADD_AUDITOR),
.purpose.size = htonl (sizeof (aa)),
- .start_date = GNUNET_TIME_absolute_hton (start_date),
+ .start_date = GNUNET_TIME_timestamp_hton (start_date),
.auditor_pub = *auditor_pub
};
@@ -76,14 +76,14 @@ TALER_exchange_offline_auditor_add_verify (
void
TALER_exchange_offline_auditor_del_sign (
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig)
{
struct TALER_MasterDelAuditorPS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_AUDITOR),
.purpose.size = htonl (sizeof (kv)),
- .end_date = GNUNET_TIME_absolute_hton (end_date),
+ .end_date = GNUNET_TIME_timestamp_hton (end_date),
.auditor_pub = *auditor_pub,
};
@@ -96,7 +96,7 @@ TALER_exchange_offline_auditor_del_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_auditor_del_verify (
const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig)
{
@@ -104,7 +104,7 @@ TALER_exchange_offline_auditor_del_verify (
.purpose.purpose = htonl (
TALER_SIGNATURE_MASTER_DEL_AUDITOR),
.purpose.size = htonl (sizeof (da)),
- .end_date = GNUNET_TIME_absolute_hton (end_date),
+ .end_date = GNUNET_TIME_timestamp_hton (end_date),
.auditor_pub = *auditor_pub
};
@@ -197,9 +197,9 @@ TALER_exchange_offline_signkey_revoke_verify (
void
TALER_exchange_offline_signkey_validity_sign (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
- struct GNUNET_TIME_Absolute end_sign,
- struct GNUNET_TIME_Absolute end_legal,
+ struct GNUNET_TIME_Timestamp start_sign,
+ struct GNUNET_TIME_Timestamp end_sign,
+ struct GNUNET_TIME_Timestamp end_legal,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig)
{
@@ -207,9 +207,9 @@ TALER_exchange_offline_signkey_validity_sign (
.purpose.purpose = htonl (
TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
.purpose.size = htonl (sizeof (skv)),
- .start = GNUNET_TIME_absolute_hton (start_sign),
- .expire = GNUNET_TIME_absolute_hton (end_sign),
- .end = GNUNET_TIME_absolute_hton (end_legal),
+ .start = GNUNET_TIME_timestamp_hton (start_sign),
+ .expire = GNUNET_TIME_timestamp_hton (end_sign),
+ .end = GNUNET_TIME_timestamp_hton (end_legal),
.signkey_pub = *exchange_pub
};
@@ -222,9 +222,9 @@ TALER_exchange_offline_signkey_validity_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_signkey_validity_verify (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
- struct GNUNET_TIME_Absolute end_sign,
- struct GNUNET_TIME_Absolute end_legal,
+ struct GNUNET_TIME_Timestamp start_sign,
+ struct GNUNET_TIME_Timestamp end_sign,
+ struct GNUNET_TIME_Timestamp end_legal,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig)
{
@@ -232,9 +232,9 @@ TALER_exchange_offline_signkey_validity_verify (
.purpose.purpose = htonl (
TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
.purpose.size = htonl (sizeof (skv)),
- .start = GNUNET_TIME_absolute_hton (start_sign),
- .expire = GNUNET_TIME_absolute_hton (end_sign),
- .end = GNUNET_TIME_absolute_hton (end_legal),
+ .start = GNUNET_TIME_timestamp_hton (start_sign),
+ .expire = GNUNET_TIME_timestamp_hton (end_sign),
+ .end = GNUNET_TIME_timestamp_hton (end_legal),
.signkey_pub = *exchange_pub
};
@@ -250,10 +250,10 @@ TALER_exchange_offline_signkey_validity_verify (
void
TALER_exchange_offline_denom_validity_sign (
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -267,10 +267,10 @@ TALER_exchange_offline_denom_validity_sign (
= htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY),
.purpose.size
= htonl (sizeof (issue)),
- .start = GNUNET_TIME_absolute_hton (stamp_start),
- .expire_withdraw = GNUNET_TIME_absolute_hton (stamp_expire_withdraw),
- .expire_deposit = GNUNET_TIME_absolute_hton (stamp_expire_deposit),
- .expire_legal = GNUNET_TIME_absolute_hton (stamp_expire_legal),
+ .start = GNUNET_TIME_timestamp_hton (stamp_start),
+ .expire_withdraw = GNUNET_TIME_timestamp_hton (stamp_expire_withdraw),
+ .expire_deposit = GNUNET_TIME_timestamp_hton (stamp_expire_deposit),
+ .expire_legal = GNUNET_TIME_timestamp_hton (stamp_expire_legal),
.denom_hash = *h_denom_pub
};
@@ -295,10 +295,10 @@ TALER_exchange_offline_denom_validity_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_denom_validity_verify (
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute stamp_start,
- struct GNUNET_TIME_Absolute stamp_expire_withdraw,
- struct GNUNET_TIME_Absolute stamp_expire_deposit,
- struct GNUNET_TIME_Absolute stamp_expire_legal,
+ struct GNUNET_TIME_Timestamp stamp_start,
+ struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
+ struct GNUNET_TIME_Timestamp stamp_expire_deposit,
+ struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@@ -312,10 +312,10 @@ TALER_exchange_offline_denom_validity_verify (
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY),
.purpose.size = htonl (sizeof (dkv)),
.master = *master_pub,
- .start = GNUNET_TIME_absolute_hton (stamp_start),
- .expire_withdraw = GNUNET_TIME_absolute_hton (stamp_expire_withdraw),
- .expire_deposit = GNUNET_TIME_absolute_hton (stamp_expire_deposit),
- .expire_legal = GNUNET_TIME_absolute_hton (stamp_expire_legal),
+ .start = GNUNET_TIME_timestamp_hton (stamp_start),
+ .expire_withdraw = GNUNET_TIME_timestamp_hton (stamp_expire_withdraw),
+ .expire_deposit = GNUNET_TIME_timestamp_hton (stamp_expire_deposit),
+ .expire_legal = GNUNET_TIME_timestamp_hton (stamp_expire_legal),
.denom_hash = *h_denom_pub
};
@@ -341,18 +341,16 @@ TALER_exchange_offline_denom_validity_verify (
void
TALER_exchange_offline_wire_add_sign (
const char *payto_uri,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig)
{
struct TALER_MasterAddWirePS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE),
.purpose.size = htonl (sizeof (kv)),
- .start_date = GNUNET_TIME_absolute_hton (now),
+ .start_date = GNUNET_TIME_timestamp_hton (now),
};
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&now));
TALER_payto_hash (payto_uri,
&kv.h_payto);
GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv,
@@ -364,14 +362,14 @@ TALER_exchange_offline_wire_add_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_add_verify (
const char *payto_uri,
- struct GNUNET_TIME_Absolute sign_time,
+ struct GNUNET_TIME_Timestamp sign_time,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig)
{
struct TALER_MasterAddWirePS aw = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE),
.purpose.size = htonl (sizeof (aw)),
- .start_date = GNUNET_TIME_absolute_hton (sign_time),
+ .start_date = GNUNET_TIME_timestamp_hton (sign_time),
};
TALER_payto_hash (payto_uri,
@@ -388,18 +386,16 @@ TALER_exchange_offline_wire_add_verify (
void
TALER_exchange_offline_wire_del_sign (
const char *payto_uri,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig)
{
struct TALER_MasterDelWirePS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_WIRE),
.purpose.size = htonl (sizeof (kv)),
- .end_date = GNUNET_TIME_absolute_hton (now),
+ .end_date = GNUNET_TIME_timestamp_hton (now),
};
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&now));
TALER_payto_hash (payto_uri,
&kv.h_payto);
GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv,
@@ -411,7 +407,7 @@ TALER_exchange_offline_wire_del_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_del_verify (
const char *payto_uri,
- struct GNUNET_TIME_Absolute sign_time,
+ struct GNUNET_TIME_Timestamp sign_time,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig)
{
@@ -419,7 +415,7 @@ TALER_exchange_offline_wire_del_verify (
.purpose.purpose = htonl (
TALER_SIGNATURE_MASTER_DEL_WIRE),
.purpose.size = htonl (sizeof (aw)),
- .end_date = GNUNET_TIME_absolute_hton (sign_time),
+ .end_date = GNUNET_TIME_timestamp_hton (sign_time),
};
TALER_payto_hash (payto_uri,
@@ -435,8 +431,8 @@ TALER_exchange_offline_wire_del_verify (
void
TALER_exchange_offline_wire_fee_sign (
const char *payment_method,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterPrivateKeyP *master_priv,
@@ -445,8 +441,8 @@ TALER_exchange_offline_wire_fee_sign (
struct TALER_MasterWireFeePS kv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES),
.purpose.size = htonl (sizeof (kv)),
- .start_date = GNUNET_TIME_absolute_hton (start_time),
- .end_date = GNUNET_TIME_absolute_hton (end_time),
+ .start_date = GNUNET_TIME_timestamp_hton (start_time),
+ .end_date = GNUNET_TIME_timestamp_hton (end_time),
};
GNUNET_CRYPTO_hash (payment_method,
@@ -465,8 +461,8 @@ TALER_exchange_offline_wire_fee_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_fee_verify (
const char *payment_method,
- struct GNUNET_TIME_Absolute start_time,
- struct GNUNET_TIME_Absolute end_time,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterPublicKeyP *master_pub,
@@ -475,8 +471,8 @@ TALER_exchange_offline_wire_fee_verify (
struct TALER_MasterWireFeePS wf = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES),
.purpose.size = htonl (sizeof (wf)),
- .start_date = GNUNET_TIME_absolute_hton (start_time),
- .end_date = GNUNET_TIME_absolute_hton (end_time)
+ .start_date = GNUNET_TIME_timestamp_hton (start_time),
+ .end_date = GNUNET_TIME_timestamp_hton (end_time)
};
GNUNET_CRYPTO_hash (payment_method,
diff --git a/src/util/secmod_signatures.c b/src/util/secmod_signatures.c
index 077ce229a..9cb15bcf5 100644
--- a/src/util/secmod_signatures.c
+++ b/src/util/secmod_signatures.c
@@ -26,7 +26,7 @@
void
TALER_exchange_secmod_eddsa_sign (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePrivateKeyP *secm_priv,
struct TALER_SecurityModuleSignatureP *secm_sig)
@@ -35,7 +35,7 @@ TALER_exchange_secmod_eddsa_sign (
.purpose.purpose = htonl (TALER_SIGNATURE_SM_SIGNING_KEY),
.purpose.size = htonl (sizeof (ska)),
.exchange_pub = *exchange_pub,
- .anchor_time = GNUNET_TIME_absolute_hton (start_sign),
+ .anchor_time = GNUNET_TIME_timestamp_hton (start_sign),
.duration = GNUNET_TIME_relative_hton (duration)
};
@@ -48,7 +48,7 @@ TALER_exchange_secmod_eddsa_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_secmod_eddsa_verify (
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePublicKeyP *secm_pub,
const struct TALER_SecurityModuleSignatureP *secm_sig)
@@ -57,7 +57,7 @@ TALER_exchange_secmod_eddsa_verify (
.purpose.purpose = htonl (TALER_SIGNATURE_SM_SIGNING_KEY),
.purpose.size = htonl (sizeof (ska)),
.exchange_pub = *exchange_pub,
- .anchor_time = GNUNET_TIME_absolute_hton (start_sign),
+ .anchor_time = GNUNET_TIME_timestamp_hton (start_sign),
.duration = GNUNET_TIME_relative_hton (duration)
};
@@ -73,7 +73,7 @@ void
TALER_exchange_secmod_rsa_sign (
const struct TALER_RsaPubHashP *h_rsa,
const char *section_name,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePrivateKeyP *secm_priv,
struct TALER_SecurityModuleSignatureP *secm_sig)
@@ -82,7 +82,7 @@ TALER_exchange_secmod_rsa_sign (
.purpose.purpose = htonl (TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY),
.purpose.size = htonl (sizeof (dka)),
.h_rsa = *h_rsa,
- .anchor_time = GNUNET_TIME_absolute_hton (start_sign),
+ .anchor_time = GNUNET_TIME_timestamp_hton (start_sign),
.duration_withdraw = GNUNET_TIME_relative_hton (duration)
};
@@ -100,7 +100,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_secmod_rsa_verify (
const struct TALER_RsaPubHashP *h_rsa,
const char *section_name,
- struct GNUNET_TIME_Absolute start_sign,
+ struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePublicKeyP *secm_pub,
const struct TALER_SecurityModuleSignatureP *secm_sig)
@@ -109,7 +109,7 @@ TALER_exchange_secmod_rsa_verify (
.purpose.purpose = htonl (TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY),
.purpose.size = htonl (sizeof (dka)),
.h_rsa = *h_rsa,
- .anchor_time = GNUNET_TIME_absolute_hton (start_sign),
+ .anchor_time = GNUNET_TIME_timestamp_hton (start_sign),
.duration_withdraw = GNUNET_TIME_relative_hton (duration)
};
diff --git a/src/util/taler-exchange-secmod-eddsa.c b/src/util/taler-exchange-secmod-eddsa.c
index 3fe9b284e..02b36fb9a 100644
--- a/src/util/taler-exchange-secmod-eddsa.c
+++ b/src/util/taler-exchange-secmod-eddsa.c
@@ -78,7 +78,7 @@ struct Key
/**
* Time at which this key is supposed to become valid.
*/
- struct GNUNET_TIME_Absolute anchor;
+ struct GNUNET_TIME_Timestamp anchor;
/**
* Generation when this key was created or revoked.
@@ -124,13 +124,13 @@ static int global_ret;
* Time when the key update is executed.
* Either the actual current time, or a pretended time.
*/
-static struct GNUNET_TIME_Absolute now;
+static struct GNUNET_TIME_Timestamp now;
/**
* The time for the key update, as passed by the user
* on the command line.
*/
-static struct GNUNET_TIME_Absolute now_tmp;
+static struct GNUNET_TIME_Timestamp now_tmp;
/**
* Where do we store the keys?
@@ -179,7 +179,7 @@ notify_client_key_add (struct TES_Client *client,
struct TALER_CRYPTO_EddsaKeyAvailableNotification an = {
.header.size = htons (sizeof (an)),
.header.type = htons (TALER_HELPER_EDDSA_MT_AVAIL),
- .anchor_time = GNUNET_TIME_absolute_hton (key->anchor),
+ .anchor_time = GNUNET_TIME_timestamp_hton (key->anchor),
.duration = GNUNET_TIME_relative_hton (duration),
.exchange_pub = key->exchange_pub,
.secm_pub = TES_smpub
@@ -274,7 +274,7 @@ handle_sign_request (struct TES_Client *client,
key = keys_head;
while ( (NULL != key) &&
(GNUNET_TIME_absolute_is_past (
- GNUNET_TIME_absolute_add (key->anchor,
+ GNUNET_TIME_absolute_add (key->anchor.abs_time,
duration))) )
{
struct Key *nxt = key->next;
@@ -284,9 +284,9 @@ handle_sign_request (struct TES_Client *client,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Deleting past key %s (expired %s ago)\n",
TALER_B2S (&nxt->exchange_pub),
- GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_relative2s (
GNUNET_TIME_absolute_get_duration (
- GNUNET_TIME_absolute_add (key->anchor,
+ GNUNET_TIME_absolute_add (key->anchor.abs_time,
duration)),
GNUNET_YES));
GNUNET_CONTAINER_DLL_remove (keys_head,
@@ -364,7 +364,7 @@ setup_key (struct Key *key,
GNUNET_asprintf (&key->filename,
"%s/%llu",
keydir,
- (unsigned long long) (key->anchor.abs_value_us
+ (unsigned long long) (key->anchor.abs_time.abs_value_us
/ GNUNET_TIME_UNIT_SECONDS.rel_value_us));
if (GNUNET_OK !=
GNUNET_DISK_fn_write (key->filename,
@@ -638,23 +638,21 @@ static enum GNUNET_GenericReturnValue
create_key (void)
{
struct Key *key;
- struct GNUNET_TIME_Absolute anchor;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp anchor;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- if (NULL == keys_tail)
+ anchor = GNUNET_TIME_timestamp_get ();
+ if (NULL != keys_tail)
{
- anchor = now;
- }
- else
- {
- anchor = GNUNET_TIME_absolute_add (keys_tail->anchor,
- GNUNET_TIME_relative_subtract (
- duration,
- overlap_duration));
- if (now.abs_value_us > anchor.abs_value_us)
- anchor = now;
+ struct GNUNET_TIME_Absolute abs;
+
+ abs = GNUNET_TIME_absolute_add (keys_tail->anchor.abs_time,
+ GNUNET_TIME_relative_subtract (
+ duration,
+ overlap_duration));
+ if (GNUNET_TIME_absolute_cmp (anchor.abs_time,
+ <,
+ abs))
+ anchor = GNUNET_TIME_absolute_to_timestamp (abs);
}
key = GNUNET_new (struct Key);
key->anchor = anchor;
@@ -689,11 +687,11 @@ key_action_time (void)
if (NULL == nxt)
return GNUNET_TIME_UNIT_ZERO_ABS;
return GNUNET_TIME_absolute_min (
- GNUNET_TIME_absolute_add (nxt->anchor,
+ GNUNET_TIME_absolute_add (nxt->anchor.abs_time,
duration),
GNUNET_TIME_absolute_subtract (
GNUNET_TIME_absolute_subtract (
- GNUNET_TIME_absolute_add (keys_tail->anchor,
+ GNUNET_TIME_absolute_add (keys_tail->anchor.abs_time,
duration),
lookahead_sign),
overlap_duration));
@@ -719,7 +717,7 @@ update_keys (void *cls)
GNUNET_TIME_absolute_is_past (
GNUNET_TIME_absolute_subtract (
GNUNET_TIME_absolute_subtract (
- GNUNET_TIME_absolute_add (keys_tail->anchor,
+ GNUNET_TIME_absolute_add (keys_tail->anchor.abs_time,
duration),
lookahead_sign),
overlap_duration)) )
@@ -743,7 +741,7 @@ update_keys (void *cls)
/* purge expired keys */
while ( (NULL != nxt) &&
GNUNET_TIME_absolute_is_past (
- GNUNET_TIME_absolute_add (nxt->anchor,
+ GNUNET_TIME_absolute_add (nxt->anchor.abs_time,
duration)))
{
if (! wake)
@@ -754,9 +752,9 @@ update_keys (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Purging past key %s (expired %s ago)\n",
TALER_B2S (&nxt->exchange_pub),
- GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_relative2s (
GNUNET_TIME_absolute_get_duration (
- GNUNET_TIME_absolute_add (nxt->anchor,
+ GNUNET_TIME_absolute_add (nxt->anchor.abs_time,
duration)),
GNUNET_YES));
purge_key (nxt);
@@ -788,7 +786,7 @@ parse_key (const char *filename,
char *anchor_s;
char dummy;
unsigned long long anchor_ll;
- struct GNUNET_TIME_Absolute anchor;
+ struct GNUNET_TIME_Timestamp anchor;
anchor_s = strrchr (filename,
'/');
@@ -810,8 +808,10 @@ parse_key (const char *filename,
filename);
return GNUNET_SYSERR;
}
- anchor.abs_value_us = anchor_ll * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
- if (anchor_ll != anchor.abs_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ anchor.abs_time.abs_value_us = anchor_ll
+ * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
+ if (anchor_ll != anchor.abs_time.abs_value_us
+ / GNUNET_TIME_UNIT_SECONDS.rel_value_us)
{
/* Integer overflow. Bad, invalid filename. */
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -850,7 +850,7 @@ parse_key (const char *filename,
NULL != pos;
pos = pos->next)
{
- if (pos->anchor.abs_value_us > anchor.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (pos->anchor, >, anchor))
break;
before = pos;
}
@@ -1012,8 +1012,6 @@ load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
"DURATION");
return GNUNET_SYSERR;
}
- GNUNET_TIME_round_rel (&overlap_duration);
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
"taler-exchange-secmod-eddsa",
@@ -1025,7 +1023,6 @@ load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
"LOOKAHEAD_SIGN");
return GNUNET_SYSERR;
}
- GNUNET_TIME_round_rel (&lookahead_sign);
return GNUNET_OK;
}
@@ -1071,7 +1068,7 @@ run (void *cls,
(void) cls;
(void) args;
(void) cfgfile;
- if (now.abs_value_us != now_tmp.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now, !=, now_tmp))
{
/* The user gave "--now", use it! */
now = now_tmp;
@@ -1079,9 +1076,8 @@ run (void *cls,
else
{
/* get current time again, we may be timetraveling! */
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
}
- GNUNET_TIME_round_abs (&now);
if (GNUNET_OK !=
load_durations (cfg))
{
@@ -1114,12 +1110,13 @@ run (void *cls,
&import_key,
NULL);
if ( (NULL != keys_head) &&
- (GNUNET_TIME_absolute_is_future (keys_head->anchor)) )
+ (GNUNET_TIME_absolute_is_future (keys_head->anchor.abs_time)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Existing anchor is in %s the future. Refusing to start\n",
- GNUNET_STRINGS_relative_time_to_string (
- GNUNET_TIME_absolute_get_remaining (keys_head->anchor),
+ GNUNET_TIME_relative2s (
+ GNUNET_TIME_absolute_get_remaining (
+ keys_head->anchor.abs_time),
GNUNET_YES));
global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
@@ -1148,11 +1145,11 @@ main (int argc,
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
- GNUNET_GETOPT_option_absolute_time ('t',
- "time",
- "TIMESTAMP",
- "pretend it is a different time for the update",
- &now_tmp),
+ GNUNET_GETOPT_option_timestamp ('t',
+ "time",
+ "TIMESTAMP",
+ "pretend it is a different time for the update",
+ &now_tmp),
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;
@@ -1164,8 +1161,9 @@ main (int argc,
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
TALER_OS_init ();
- now = now_tmp = GNUNET_TIME_absolute_get ();
- ret = GNUNET_PROGRAM_run (argc, argv,
+ now_tmp = now = GNUNET_TIME_timestamp_get ();
+ ret = GNUNET_PROGRAM_run (argc,
+ argv,
"taler-exchange-secmod-eddsa",
"Handle private EDDSA key operations for a Taler exchange",
options,
diff --git a/src/util/taler-exchange-secmod-eddsa.h b/src/util/taler-exchange-secmod-eddsa.h
index 39054c414..c05d90a6c 100644
--- a/src/util/taler-exchange-secmod-eddsa.h
+++ b/src/util/taler-exchange-secmod-eddsa.h
@@ -54,7 +54,7 @@ struct TALER_CRYPTO_EddsaKeyAvailableNotification
/**
* When does the key become available?
*/
- struct GNUNET_TIME_AbsoluteNBO anchor_time;
+ struct GNUNET_TIME_TimestampNBO anchor_time;
/**
* How long is the key available after @e anchor_time?
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index e121e9ab6..e40c8e39f 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -98,7 +98,7 @@ struct DenominationKey
/**
* Time at which this key is supposed to become valid.
*/
- struct GNUNET_TIME_Absolute anchor;
+ struct GNUNET_TIME_Timestamp anchor;
/**
* Generation when this key was created or revoked.
@@ -173,13 +173,13 @@ static int global_ret;
* Time when the key update is executed.
* Either the actual current time, or a pretended time.
*/
-static struct GNUNET_TIME_Absolute now;
+static struct GNUNET_TIME_Timestamp now;
/**
* The time for the key update, as passed by the user
* on the command line.
*/
-static struct GNUNET_TIME_Absolute now_tmp;
+static struct GNUNET_TIME_Timestamp now_tmp;
/**
* Where do we store the keys?
@@ -257,7 +257,7 @@ generate_response (struct DenominationKey *dk)
an->header.type = htons (TALER_HELPER_RSA_MT_AVAIL);
an->pub_size = htons ((uint16_t) buf_len);
an->section_name_len = htons ((uint16_t) nlen);
- an->anchor_time = GNUNET_TIME_absolute_hton (dk->anchor);
+ an->anchor_time = GNUNET_TIME_timestamp_hton (dk->anchor);
an->duration_withdraw = GNUNET_TIME_relative_hton (denom->duration_withdraw);
TALER_exchange_secmod_rsa_sign (&dk->h_rsa,
denom->section,
@@ -315,8 +315,7 @@ handle_sign_request (struct TES_Client *client,
return TES_transmit (client->csock,
&sf.header);
}
- if (0 !=
- GNUNET_TIME_absolute_get_remaining (dk->anchor).rel_value_us)
+ if (GNUNET_TIME_absolute_is_future (dk->anchor.abs_time))
{
/* it is too early */
struct TALER_CRYPTO_SignFailure sf = {
@@ -383,14 +382,14 @@ handle_sign_request (struct TES_Client *client,
GNUNET_free (buf);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Sending RSA signature after %s\n",
- GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_relative2s (
GNUNET_TIME_absolute_get_duration (now),
GNUNET_YES));
ret = TES_transmit (client->csock,
&sr->header);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Sent RSA signature after %s\n",
- GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_relative2s (
GNUNET_TIME_absolute_get_duration (now),
GNUNET_YES));
GNUNET_free (sr);
@@ -439,7 +438,7 @@ setup_key (struct DenominationKey *dk,
"%s/%s/%llu",
keydir,
denom->section,
- (unsigned long long) (dk->anchor.abs_value_us
+ (unsigned long long) (dk->anchor.abs_time.abs_value_us
/ GNUNET_TIME_UNIT_SECONDS.rel_value_us));
if (GNUNET_OK !=
GNUNET_DISK_fn_write (dk->filename,
@@ -459,7 +458,7 @@ setup_key (struct DenominationKey *dk,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Setup fresh private key %s at %s in `%s' (generation #%llu)\n",
GNUNET_h2s (&dk->h_rsa.hash),
- GNUNET_STRINGS_absolute_time_to_string (dk->anchor),
+ GNUNET_TIME_timestamp2s (dk->anchor),
dk->filename,
(unsigned long long) key_gen);
dk->denom_priv = priv;
@@ -785,23 +784,22 @@ rsa_update_client_keys (struct TES_Client *client)
*/
static enum GNUNET_GenericReturnValue
create_key (struct Denomination *denom,
- struct GNUNET_TIME_Absolute now)
+ struct GNUNET_TIME_Timestamp now)
{
struct DenominationKey *dk;
- struct GNUNET_TIME_Absolute anchor;
+ struct GNUNET_TIME_Timestamp anchor;
- if (NULL == denom->keys_tail)
- {
- anchor = now;
- }
- else
+ anchor = now;
+ if (NULL != denom->keys_tail)
{
- anchor = GNUNET_TIME_absolute_add (denom->keys_tail->anchor,
- GNUNET_TIME_relative_subtract (
- denom->duration_withdraw,
- overlap_duration));
- if (now.abs_value_us > anchor.abs_value_us)
- anchor = now;
+ struct GNUNET_TIME_Absolute abs;
+
+ abs = GNUNET_TIME_absolute_add (denom->keys_tail->anchor.abs_time,
+ GNUNET_TIME_relative_subtract (
+ denom->duration_withdraw,
+ overlap_duration));
+ if (GNUNET_TIME_absolute_cmp (now.abs_time, <, abs))
+ anchor = GNUNET_TIME_absolute_to_timestamp (abs);
}
dk = GNUNET_new (struct DenominationKey);
dk->denom = denom;
@@ -839,14 +837,14 @@ denomination_action_time (const struct Denomination *denom)
return GNUNET_TIME_UNIT_ZERO_ABS;
tt = GNUNET_TIME_absolute_subtract (
GNUNET_TIME_absolute_subtract (
- GNUNET_TIME_absolute_add (tail->anchor,
+ GNUNET_TIME_absolute_add (tail->anchor.abs_time,
denom->duration_withdraw),
lookahead_sign),
overlap_duration);
if (head->rc > 0)
return tt; /* head expiration does not count due to rc > 0 */
return GNUNET_TIME_absolute_min (
- GNUNET_TIME_absolute_add (head->anchor,
+ GNUNET_TIME_absolute_add (head->anchor.abs_time,
denom->duration_withdraw),
tt);
}
@@ -864,7 +862,7 @@ denomination_action_time (const struct Denomination *denom)
*/
static enum GNUNET_GenericReturnValue
update_keys (struct Denomination *denom,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
bool *wake)
{
/* create new denomination keys */
@@ -873,11 +871,11 @@ update_keys (struct Denomination *denom,
"Updating keys of denomination `%s', last key %s valid for another %s\n",
denom->section,
GNUNET_h2s (&denom->keys_tail->h_rsa.hash),
- GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_relative2s (
GNUNET_TIME_absolute_get_remaining (
GNUNET_TIME_absolute_subtract (
GNUNET_TIME_absolute_add (
- denom->keys_tail->anchor,
+ denom->keys_tail->anchor.abs_time,
denom->duration_withdraw),
overlap_duration)),
GNUNET_YES));
@@ -885,7 +883,7 @@ update_keys (struct Denomination *denom,
GNUNET_TIME_absolute_is_past (
GNUNET_TIME_absolute_subtract (
GNUNET_TIME_absolute_subtract (
- GNUNET_TIME_absolute_add (denom->keys_tail->anchor,
+ GNUNET_TIME_absolute_add (denom->keys_tail->anchor.abs_time,
denom->duration_withdraw),
lookahead_sign),
overlap_duration)) )
@@ -908,7 +906,7 @@ update_keys (struct Denomination *denom,
/* remove expired denomination keys */
while ( (NULL != denom->keys_head) &&
GNUNET_TIME_absolute_is_past
- (GNUNET_TIME_absolute_add (denom->keys_head->anchor,
+ (GNUNET_TIME_absolute_add (denom->keys_head->anchor.abs_time,
denom->duration_withdraw)) )
{
struct DenominationKey *key = denom->keys_head;
@@ -951,7 +949,7 @@ update_keys (struct Denomination *denom,
NULL != pos;
pos = pos->next)
{
- if (denomination_action_time (pos).abs_value_us >= at.abs_value_us)
+ if (GNUNET_TIME_absolute_cmp (denomination_action_time (pos), >=, at))
break;
before = pos;
}
@@ -974,12 +972,13 @@ update_denominations (void *cls)
{
struct Denomination *denom;
struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp t;
bool wake = false;
(void) cls;
keygen_task = NULL;
now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ t = GNUNET_TIME_absolute_to_timestamp (now);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Updating denominations ...\n");
GNUNET_assert (0 == pthread_mutex_lock (&keys_lock));
@@ -987,7 +986,7 @@ update_denominations (void *cls)
denom = denom_head;
if (GNUNET_OK !=
update_keys (denom,
- now,
+ t,
&wake))
return;
} while (denom != denom_head);
@@ -1020,7 +1019,7 @@ parse_key (struct Denomination *denom,
char *anchor_s;
char dummy;
unsigned long long anchor_ll;
- struct GNUNET_TIME_Absolute anchor;
+ struct GNUNET_TIME_Timestamp anchor;
anchor_s = strrchr (filename,
'/');
@@ -1042,8 +1041,10 @@ parse_key (struct Denomination *denom,
filename);
return;
}
- anchor.abs_value_us = anchor_ll * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
- if (anchor_ll != anchor.abs_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ anchor.abs_time.abs_value_us
+ = anchor_ll * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
+ if (anchor_ll != anchor.abs_time.abs_value_us
+ / GNUNET_TIME_UNIT_SECONDS.rel_value_us)
{
/* Integer overflow. Bad, invalid filename. */
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1105,7 +1106,7 @@ parse_key (struct Denomination *denom,
NULL != pos;
pos = pos->next)
{
- if (pos->anchor.abs_value_us > anchor.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (pos->anchor, >, anchor))
break;
before = pos;
}
@@ -1267,9 +1268,9 @@ parse_denomination_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
"DURATION_WITHDRAW");
return GNUNET_SYSERR;
}
- GNUNET_TIME_round_rel (&denom->duration_withdraw);
- if (overlap_duration.rel_value_us >=
- denom->duration_withdraw.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (overlap_duration,
+ >=,
+ denom->duration_withdraw))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"taler-exchange-secmod-rsa",
@@ -1317,7 +1318,7 @@ struct LoadContext
/**
* Current time to use.
*/
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp t;
/**
* Status, to be set to #GNUNET_SYSERR on failure
@@ -1379,7 +1380,7 @@ load_denominations (void *cls,
denom_tail,
denom);
update_keys (denom,
- ctx->now,
+ ctx->t,
&wake);
}
@@ -1404,8 +1405,6 @@ load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
"OVERLAP_DURATION");
return GNUNET_SYSERR;
}
- GNUNET_TIME_round_rel (&overlap_duration);
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
"taler-exchange-secmod-rsa",
@@ -1417,7 +1416,6 @@ load_durations (const struct GNUNET_CONFIGURATION_Handle *cfg)
"LOOKAHEAD_SIGN");
return GNUNET_SYSERR;
}
- GNUNET_TIME_round_rel (&lookahead_sign);
return GNUNET_OK;
}
@@ -1459,10 +1457,11 @@ run (void *cls,
.updater = rsa_update_client_keys,
.init = rsa_client_init
};
+
(void) cls;
(void) args;
(void) cfgfile;
- if (now.abs_value_us != now_tmp.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (now, !=, now_tmp))
{
/* The user gave "--now", use it! */
now = now_tmp;
@@ -1470,9 +1469,8 @@ run (void *cls,
else
{
/* get current time again, we may be timetraveling! */
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
}
- GNUNET_TIME_round_abs (&now);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
"taler-exchange-secmod-rsa",
@@ -1505,10 +1503,9 @@ run (void *cls,
struct LoadContext lc = {
.cfg = cfg,
.ret = GNUNET_OK,
- .now = now
+ .t = now
};
- (void) GNUNET_TIME_round_abs (&lc.now);
GNUNET_assert (0 == pthread_mutex_lock (&keys_lock));
GNUNET_CONFIGURATION_iterate_sections (cfg,
&load_denominations,
@@ -1552,11 +1549,11 @@ main (int argc,
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
- GNUNET_GETOPT_option_absolute_time ('t',
- "time",
- "TIMESTAMP",
- "pretend it is a different time for the update",
- &now_tmp),
+ GNUNET_GETOPT_option_timestamp ('t',
+ "time",
+ "TIMESTAMP",
+ "pretend it is a different time for the update",
+ &now_tmp),
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;
@@ -1568,7 +1565,7 @@ main (int argc,
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
TALER_OS_init ();
- now = now_tmp = GNUNET_TIME_absolute_get ();
+ now_tmp = now = GNUNET_TIME_timestamp_get ();
ret = GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-secmod-rsa",
"Handle private RSA key operations for a Taler exchange",
diff --git a/src/util/taler-exchange-secmod-rsa.h b/src/util/taler-exchange-secmod-rsa.h
index b0fdfbd96..61fa58811 100644
--- a/src/util/taler-exchange-secmod-rsa.h
+++ b/src/util/taler-exchange-secmod-rsa.h
@@ -59,7 +59,7 @@ struct TALER_CRYPTO_RsaKeyAvailableNotification
/**
* When does the key become available?
*/
- struct GNUNET_TIME_AbsoluteNBO anchor_time;
+ struct GNUNET_TIME_TimestampNBO anchor_time;
/**
* How long is the key available after @e anchor_time?
diff --git a/src/util/test_helper_eddsa.c b/src/util/test_helper_eddsa.c
index 471441c68..da1c51b46 100644
--- a/src/util/test_helper_eddsa.c
+++ b/src/util/test_helper_eddsa.c
@@ -65,7 +65,7 @@ struct KeyData
/**
* Validity start point.
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* Key expires for signing at @e start_time plus this value.
@@ -112,7 +112,7 @@ static struct KeyData keys[MAX_KEYS];
*/
static void
key_cb (void *cls,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_SecurityModulePublicKeyP *sm_pub,
@@ -207,7 +207,7 @@ test_revocation (struct TALER_CRYPTO_ExchangeSignHelper *esh)
TALER_CRYPTO_helper_esign_poll (esh);
if ( (! keys[j].revoked) ||
(GNUNET_TIME_absolute_is_past (
- GNUNET_TIME_absolute_add (keys[j].start_time,
+ GNUNET_TIME_absolute_add (keys[j].start_time.abs_time,
keys[j].validity_duration))) )
{
break;
@@ -217,7 +217,7 @@ test_revocation (struct TALER_CRYPTO_ExchangeSignHelper *esh)
}
if ( (keys[j].revoked) &&
(! GNUNET_TIME_absolute_is_past (
- GNUNET_TIME_absolute_add (keys[j].start_time,
+ GNUNET_TIME_absolute_add (keys[j].start_time.abs_time,
keys[j].validity_duration))) )
{
fprintf (stderr,
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
index bafa45ba8..ac4ae1dc0 100644
--- a/src/util/test_helper_rsa.c
+++ b/src/util/test_helper_rsa.c
@@ -64,7 +64,7 @@ struct KeyData
/**
* Validity start point.
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* Key expires for signing at @e start_time plus this value.
@@ -137,7 +137,7 @@ free_keys (void)
static void
key_cb (void *cls,
const char *section_name,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_RsaPubHashP *h_rsa,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -297,15 +297,19 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
switch (ec)
{
case TALER_EC_NONE:
- if (GNUNET_TIME_absolute_get_remaining (keys[i].start_time).rel_value_us >
- GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_remaining (
+ keys[i].start_time.abs_time),
+ >,
+ GNUNET_TIME_UNIT_SECONDS))
{
/* key worked too early */
GNUNET_break (0);
return 4;
}
- if (GNUNET_TIME_absolute_get_duration (keys[i].start_time).rel_value_us >
- keys[i].validity_duration.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
+ keys[i].start_time.abs_time),
+ >,
+ keys[i].validity_duration))
{
/* key worked too later */
GNUNET_break (0);
@@ -344,12 +348,14 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
case TALER_EC_EXCHANGE_DENOMINATION_HELPER_TOO_EARLY:
/* This 'failure' is expected, we're testing also for the
error handling! */
- if ( (0 ==
- GNUNET_TIME_absolute_get_remaining (
- keys[i].start_time).rel_value_us) &&
- (GNUNET_TIME_absolute_get_duration (
- keys[i].start_time).rel_value_us <
- keys[i].validity_duration.rel_value_us) )
+ if ( (GNUNET_TIME_relative_is_zero (
+ GNUNET_TIME_absolute_get_remaining (
+ keys[i].start_time.abs_time))) &&
+ (GNUNET_TIME_relative_cmp (
+ GNUNET_TIME_absolute_get_duration (
+ keys[i].start_time.abs_time),
+ <,
+ keys[i].validity_duration)) )
{
/* key should have worked! */
GNUNET_break (0);
@@ -422,11 +428,15 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
{
if (! keys[i].valid)
continue;
- if (GNUNET_TIME_absolute_get_remaining (keys[i].start_time).rel_value_us >
- GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_remaining (
+ keys[i].start_time.abs_time),
+ >,
+ GNUNET_TIME_UNIT_SECONDS))
continue;
- if (GNUNET_TIME_absolute_get_duration (keys[i].start_time).rel_value_us >
- keys[i].validity_duration.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
+ keys[i].start_time.abs_time),
+ >,
+ keys[i].validity_duration))
continue;
{
struct TALER_CoinPubHash c_hash;
diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c
index 8700d4a80..b895de14b 100644
--- a/src/util/wallet_signatures.c
+++ b/src/util/wallet_signatures.c
@@ -31,9 +31,9 @@ TALER_wallet_deposit_sign (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute wallet_timestamp,
+ struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig)
{
@@ -43,17 +43,13 @@ TALER_wallet_deposit_sign (
.h_contract_terms = *h_contract_terms,
.h_wire = *h_wire,
.h_denom_pub = *h_denom_pub,
- .wallet_timestamp = GNUNET_TIME_absolute_hton (wallet_timestamp),
- .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
+ .wallet_timestamp = GNUNET_TIME_timestamp_hton (wallet_timestamp),
+ .refund_deadline = GNUNET_TIME_timestamp_hton (refund_deadline),
.merchant = *merchant_pub
};
if (NULL != h_extensions)
dr.h_extensions = *h_extensions;
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&wallet_timestamp));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&refund_deadline));
TALER_amount_hton (&dr.amount_with_fee,
amount);
TALER_amount_hton (&dr.deposit_fee,
@@ -72,9 +68,9 @@ TALER_wallet_deposit_verify (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
- struct GNUNET_TIME_Absolute wallet_timestamp,
+ struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig)
{
@@ -84,8 +80,8 @@ TALER_wallet_deposit_verify (
.h_contract_terms = *h_contract_terms,
.h_wire = *h_wire,
.h_denom_pub = *h_denom_pub,
- .wallet_timestamp = GNUNET_TIME_absolute_hton (wallet_timestamp),
- .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
+ .wallet_timestamp = GNUNET_TIME_timestamp_hton (wallet_timestamp),
+ .refund_deadline = GNUNET_TIME_timestamp_hton (refund_deadline),
.merchant = *merchant_pub
};