summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 16:10:40 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 16:10:40 +0100
commitad5d54f48534ac0ad5bfd7f048bd7782e674a89b (patch)
tree4443e41c1aec412d82642b194aa3d837c9eb5cfd /src
parent49e2e44b09dd845d0922c0acef5ff487b52bf26d (diff)
downloadmerchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.tar.gz
merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.tar.bz2
merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.zip
migration to protocol v11
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd.h2
-rw-r--r--src/backend/taler-merchant-httpd_auditors.c2
-rw-r--r--src/backend/taler-merchant-httpd_config.c3
-rw-r--r--src/backend/taler-merchant-httpd_exchanges.c44
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c2
-rw-r--r--src/backend/taler-merchant-httpd_get-tips-ID.c12
-rw-r--r--src/backend/taler-merchant-httpd_helper.c6
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-abort.c4
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-claim.c6
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c46
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-refund.c16
-rw-r--r--src/backend/taler-merchant-httpd_post-tips-ID-pickup.c4
-rw-r--r--src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c14
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c33
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders.c42
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders.h2
-rw-r--r--src/backend/taler-merchant-httpd_private-get-products-ID.c2
-rw-r--r--src/backend/taler-merchant-httpd_private-get-reserves-ID.c17
-rw-r--r--src/backend/taler-merchant-httpd_private-get-reserves.c19
-rw-r--r--src/backend/taler-merchant-httpd_private-get-tips-ID.c9
-rw-r--r--src/backend/taler-merchant-httpd_private-get-transfers.c22
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-instances-ID.c8
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-products-ID.c2
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c8
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c20
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c127
-rw-r--r--src/backend/taler-merchant-httpd_private-post-products-ID-lock.c6
-rw-r--r--src/backend/taler-merchant-httpd_private-post-products.c9
-rw-r--r--src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c7
-rw-r--r--src/backend/taler-merchant-httpd_private-post-reserves.c4
-rw-r--r--src/backend/taler-merchant-httpd_private-post-transfers.c38
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c274
-rw-r--r--src/backenddb/test_merchantdb.c276
-rw-r--r--src/include/taler_merchant_service.h44
-rw-r--r--src/include/taler_merchant_testing_lib.h42
-rw-r--r--src/include/taler_merchantdb_plugin.h70
-rw-r--r--src/lib/Makefile.am2
-rw-r--r--src/lib/merchant_api_get_instance.c8
-rw-r--r--src/lib/merchant_api_get_orders.c16
-rw-r--r--src/lib/merchant_api_get_product.c9
-rw-r--r--src/lib/merchant_api_get_reserve.c4
-rw-r--r--src/lib/merchant_api_get_reserves.c20
-rw-r--r--src/lib/merchant_api_get_transfers.c26
-rw-r--r--src/lib/merchant_api_merchant_get_order.c6
-rw-r--r--src/lib/merchant_api_merchant_get_tip.c10
-rw-r--r--src/lib/merchant_api_patch_product.c7
-rw-r--r--src/lib/merchant_api_post_order_pay.c9
-rw-r--r--src/lib/merchant_api_post_orders.c2
-rw-r--r--src/lib/merchant_api_post_products.c7
-rw-r--r--src/lib/merchant_api_post_transfers.c8
-rw-r--r--src/lib/merchant_api_tip_authorize.c6
-rw-r--r--src/lib/merchant_api_wallet_get_tip.c8
-rw-r--r--src/merchant-tools/taler-merchant-benchmark.c16
-rw-r--r--src/testing/test_kyc_api.c4
-rw-r--r--src/testing/test_merchant_api.c70
-rw-r--r--src/testing/test_merchant_api_twisted.c20
-rw-r--r--src/testing/testing_api_cmd_get_orders.c15
-rw-r--r--src/testing/testing_api_cmd_get_product.c18
-rw-r--r--src/testing/testing_api_cmd_get_reserves.c2
-rw-r--r--src/testing/testing_api_cmd_get_transfers.c17
-rw-r--r--src/testing/testing_api_cmd_merchant_get_tip.c19
-rw-r--r--src/testing/testing_api_cmd_patch_product.c8
-rw-r--r--src/testing/testing_api_cmd_pay_order.c18
-rw-r--r--src/testing/testing_api_cmd_post_orders.c39
-rw-r--r--src/testing/testing_api_cmd_post_products.c10
-rw-r--r--src/testing/testing_api_cmd_post_transfers.c8
-rw-r--r--src/testing/testing_api_cmd_tip_authorize.c8
-rw-r--r--src/testing/testing_api_cmd_wallet_get_tip.c14
68 files changed, 850 insertions, 826 deletions
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index f81b15aa..93ca63d3 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -304,7 +304,7 @@ struct TMH_OrderChangeEventDetailsP
/**
* Execution date of the order.
*/
- struct GNUNET_TIME_AbsoluteNBO execution_date;
+ struct GNUNET_TIME_TimestampNBO execution_date;
/**
* See `enum TMH_OrderStateFlags`. In NBO.
diff --git a/src/backend/taler-merchant-httpd_auditors.c b/src/backend/taler-merchant-httpd_auditors.c
index e693935e..27b3524a 100644
--- a/src/backend/taler-merchant-httpd_auditors.c
+++ b/src/backend/taler-merchant-httpd_auditors.c
@@ -72,7 +72,7 @@ TMH_AUDITORS_check_dk (struct TALER_EXCHANGE_Handle *mh,
const struct TALER_EXCHANGE_Keys *keys;
const struct TALER_EXCHANGE_AuditorInformation *ai;
- if (GNUNET_TIME_absolute_is_past (dk->expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->expire_deposit.abs_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Denomination key offered by client has expired for deposits\n");
diff --git a/src/backend/taler-merchant-httpd_config.c b/src/backend/taler-merchant-httpd_config.c
index 8f92bd07..753a25da 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -42,7 +42,8 @@
* #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in
* merchant_api_config.c!
*/
-#define MERCHANT_PROTOCOL_VERSION "2:0:0"
+#define MERCHANT_PROTOCOL_VERSION "3:0:0"
+
MHD_RESULT
MH_handler_config (struct TMH_RequestHandler *rh,
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c
index f3603efe..accbd9c9 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -366,11 +366,15 @@ process_wire_fees (struct Exchange *exchange,
endp = endp->next;
while ( (NULL != endp) &&
(NULL != fees) &&
- (fees->start_date.abs_value_us < endp->end_date.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (fees->start_date,
+ <,
+ endp->end_date)) )
fees = fees->next;
if ( (NULL != endp) &&
(NULL != fees) &&
- (fees->start_date.abs_value_us != endp->end_date.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (fees->start_date,
+ !=,
+ endp->end_date)) )
{
/* Hole in the fee structure, not allowed! */
GNUNET_break_op (0);
@@ -390,7 +394,7 @@ process_wire_fees (struct Exchange *exchange,
"Storing wire fee for `%s' and method `%s' at %s in DB; the fee is %s\n",
TALER_B2S (master_pub),
wire_method,
- GNUNET_STRINGS_absolute_time_to_string (af->start_date),
+ GNUNET_TIME_timestamp2s (af->start_date),
TALER_amount2s (&af->wire_fee));
TMH_db->preflight (TMH_db->cls);
if (GNUNET_OK !=
@@ -504,7 +508,7 @@ process_wire_accounts (struct Exchange *exchange,
*/
static struct FeesByWireMethod *
get_wire_fees (struct Exchange *exchange,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
const char *wire_method)
{
for (struct FeesByWireMethod *fbw = exchange->wire_fees_head;
@@ -518,7 +522,9 @@ get_wire_fees (struct Exchange *exchange,
/* Advance through list up to current time */
while ( (NULL != (af = fbw->af)) &&
- (now.abs_value_us >= af->end_date.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (now,
+ >=,
+ af->end_date)) )
{
fbw->af = af->next;
GNUNET_free (af);
@@ -545,10 +551,10 @@ static bool
process_find_operations (struct Exchange *exchange)
{
struct TMH_EXCHANGES_FindOperation *fn;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
bool need_wire;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
need_wire = false;
for (struct TMH_EXCHANGES_FindOperation *fo = exchange->fo_head;
NULL != fo;
@@ -583,14 +589,17 @@ process_find_operations (struct Exchange *exchange)
fbw = NULL;
continue;
}
- if (fbw->af->start_date.abs_value_us > now.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (fbw->af->start_date,
+ >,
+ now))
{
/* Disagreement on the current time */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Exchange's earliest fee is %s ahead of our time. Clock skew issue?\n",
- GNUNET_STRINGS_relative_time_to_string (
- GNUNET_TIME_absolute_get_remaining (fbw->af->start_date),
- GNUNET_YES));
+ GNUNET_TIME_relative2s (
+ GNUNET_TIME_absolute_get_remaining (
+ fbw->af->start_date.abs_time),
+ true));
fbw = NULL;
continue;
}
@@ -902,7 +911,7 @@ keys_mgmt_cb (void *cls,
enum TALER_EXCHANGE_VersionCompatibility compat)
{
struct Exchange *exchange = cls;
- struct GNUNET_TIME_Absolute expire;
+ struct GNUNET_TIME_Timestamp expire;
struct GNUNET_TIME_Relative delay;
if ( (MHD_HTTP_OK != hr->http_status) ||
@@ -979,13 +988,13 @@ keys_mgmt_cb (void *cls,
}
}
+ exchange->first_retry = GNUNET_TIME_relative_to_absolute (RELOAD_DELAY);
expire = TALER_EXCHANGE_check_keys_current (exchange->conn,
TALER_EXCHANGE_CKF_NONE);
- exchange->first_retry = GNUNET_TIME_relative_to_absolute (RELOAD_DELAY);
- if (0 == expire.abs_value_us)
+ if (0 == GNUNET_TIME_absolute_is_zero (expire.abs_time))
delay = RELOAD_DELAY;
else
- delay = GNUNET_TIME_absolute_get_remaining (expire);
+ delay = GNUNET_TIME_absolute_get_remaining (expire.abs_time);
if (GNUNET_TIME_relative_is_zero (delay))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1049,7 +1058,7 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange,
{
struct Exchange *exchange;
struct TMH_EXCHANGES_FindOperation *fo;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL == merchant_curl_ctx)
{
@@ -1115,8 +1124,7 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange,
return fo;
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
if ( (! exchange->pending) &&
( (NULL == fo->wire_method) ||
(NULL != get_wire_fees (exchange,
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index ddc1c1c7..db1c3fee 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -738,7 +738,7 @@ send_pay_request (struct GetOrderData *god,
static void
process_refunds_cb (void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
diff --git a/src/backend/taler-merchant-httpd_get-tips-ID.c b/src/backend/taler-merchant-httpd_get-tips-ID.c
index 5b0abd89..4b4b2858 100644
--- a/src/backend/taler-merchant-httpd_get-tips-ID.c
+++ b/src/backend/taler-merchant-httpd_get-tips-ID.c
@@ -159,7 +159,7 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
enum GNUNET_DB_QueryStatus qs;
struct TALER_Amount total_authorized;
struct TALER_Amount total_picked_up;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
char *exchange_url;
struct TALER_ReservePrivateKeyP reserve_priv;
@@ -210,15 +210,12 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
/* Build response */
{
struct TALER_Amount remaining;
- struct GNUNET_TIME_Absolute expiration_round = expiration;
MHD_RESULT ret;
GNUNET_break (0 <=
TALER_amount_subtract (&remaining,
&total_authorized,
&total_picked_up));
-
- GNUNET_TIME_round_abs (&expiration_round);
if (TMH_MHD_test_html_desired (connection))
{
char *qr;
@@ -274,16 +271,15 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
{
ret = TALER_MHD_REPLY_JSON_PACK (
connection,
- ( (0 == remaining.value) &&
- (0 == remaining.fraction) )
+ TALER_amount_is_zero (&remaining)
? MHD_HTTP_GONE
: MHD_HTTP_OK,
GNUNET_JSON_pack_string ("exchange_url",
exchange_url),
TALER_JSON_pack_amount ("tip_amount",
&remaining),
- GNUNET_JSON_pack_time_abs ("expiration",
- expiration_round));
+ GNUNET_JSON_pack_timestamp ("expiration",
+ expiration));
}
GNUNET_free (exchange_url);
return ret;
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
index fe686dd3..e271cbaa 100644
--- a/src/backend/taler-merchant-httpd_helper.c
+++ b/src/backend/taler-merchant-httpd_helper.c
@@ -195,7 +195,7 @@ TMH_products_array_valid (const json_t *products)
struct TALER_Amount price;
const char *image_data_url = NULL;
json_t *taxes = NULL;
- struct GNUNET_TIME_Absolute delivery_date;
+ struct GNUNET_TIME_Timestamp delivery_date;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("product_id",
@@ -222,8 +222,8 @@ TMH_products_array_valid (const json_t *products)
GNUNET_JSON_spec_json ("taxes",
&taxes)),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_absolute_time ("delivery_date",
- &delivery_date)),
+ GNUNET_JSON_spec_timestamp ("delivery_date",
+ &delivery_date)),
GNUNET_JSON_spec_end ()
};
const char *ename;
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
index e3afaffb..4c5f0313 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
@@ -658,13 +658,13 @@ refund_coins (void *cls,
const struct TALER_Amount *wire_fee)
{
struct AbortContext *ac = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) amount_with_fee;
(void) deposit_fee;
(void) refund_fee;
(void) wire_fee;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
for (unsigned int i = 0; i<ac->coins_cnt; i++)
{
struct RefundDetails *rdi = &ac->rd[i];
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
index 089933ea..16990d4b 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
@@ -123,10 +123,10 @@ claim_order (const char *instance_id,
{
struct GNUNET_HashCode unused;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index 7867e1ea..bea47c4e 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -291,22 +291,22 @@ struct PayContext
* Wire transfer deadline. How soon would the merchant like the
* wire transfer to be executed?
*/
- struct GNUNET_TIME_Absolute wire_transfer_deadline;
+ struct GNUNET_TIME_Timestamp wire_transfer_deadline;
/**
* Timestamp from @e contract_terms.
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Refund deadline from @e contract_terms.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* Deadline for the customer to pay for this proposal.
*/
- struct GNUNET_TIME_Absolute pay_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
/**
* Number of transactions that the wire fees are expected to be
@@ -419,7 +419,7 @@ struct KycContext
/**
* Initial DB timestamp.
*/
- struct GNUNET_TIME_Absolute kyc_timestamp;
+ struct GNUNET_TIME_Timestamp kyc_timestamp;
/**
* Initial KYC status.
@@ -686,11 +686,10 @@ deposit_get_callback (
{
struct KycContext *kc = cls;
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
kc->dg = NULL;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
switch (dr->hr.http_status)
{
case MHD_HTTP_OK:
@@ -791,7 +790,7 @@ kyc_cb (
uint64_t exchange_kyc_serial,
const char *payto_uri,
const char *exchange_url,
- struct GNUNET_TIME_Absolute last_check,
+ struct GNUNET_TIME_Timestamp last_check,
bool kyc_ok)
{
struct KycContext *kc = cls;
@@ -837,8 +836,10 @@ check_kyc (struct PayContext *pc,
GNUNET_free (kc);
return; /* we are done */
}
- if (GNUNET_TIME_absolute_get_duration (kc->kyc_timestamp).rel_value_us <
- KYC_RETRY_FREQUENCY.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
+ kc->kyc_timestamp.abs_time),
+ <,
+ KYC_RETRY_FREQUENCY))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Not re-checking KYC status at `%s', as we already recently asked\n",
@@ -2113,14 +2114,14 @@ parse_pay (struct MHD_Connection *connection,
&pc->max_wire_fee),
GNUNET_JSON_spec_uint32 ("wire_fee_amortization",
&pc->wire_fee_amortization),
- TALER_JSON_spec_absolute_time ("timestamp",
- &pc->timestamp),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &pc->refund_deadline),
- TALER_JSON_spec_absolute_time ("pay_deadline",
- &pc->pay_deadline),
- TALER_JSON_spec_absolute_time ("wire_transfer_deadline",
- &pc->wire_transfer_deadline),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &pc->timestamp),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &pc->refund_deadline),
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &pc->pay_deadline),
+ GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
+ &pc->wire_transfer_deadline),
GNUNET_JSON_spec_fixed_auto ("h_wire",
&pc->h_wire),
GNUNET_JSON_spec_end ()
@@ -2140,8 +2141,9 @@ parse_pay (struct MHD_Connection *connection,
}
}
- if (pc->wire_transfer_deadline.abs_value_us <
- pc->refund_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (pc->wire_transfer_deadline,
+ <,
+ pc->refund_deadline))
{
/* This should already have been checked when creating the order! */
GNUNET_break (0);
@@ -2151,7 +2153,7 @@ parse_pay (struct MHD_Connection *connection,
NULL);
}
- if (GNUNET_TIME_absolute_is_past (pc->pay_deadline))
+ if (GNUNET_TIME_absolute_is_past (pc->pay_deadline.abs_time))
{
/* too late */
return (MHD_YES ==
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
index 8ba00129..c6011d21 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
@@ -79,7 +79,7 @@ struct CoinRefund
* When did the merchant grant the refund. To be used to group events
* in the wallet.
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Coin to refund.
@@ -500,7 +500,7 @@ exchange_found_cb (void *cls,
static void
process_refunds_cb (void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
@@ -770,8 +770,8 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
&cr->coin_pub),
TALER_JSON_pack_amount ("refund_amount",
&cr->refund_amount),
- GNUNET_JSON_pack_time_abs ("execution_time",
- cr->execution_time));
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ cr->execution_time));
}
else
{
@@ -790,8 +790,8 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
&cr->coin_pub),
TALER_JSON_pack_amount ("refund_amount",
&cr->refund_amount),
- GNUNET_JSON_pack_time_abs ("execution_time",
- cr->execution_time));
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ cr->execution_time));
}
}
else
@@ -811,8 +811,8 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
&cr->coin_pub),
TALER_JSON_pack_amount ("refund_amount",
&cr->refund_amount),
- GNUNET_JSON_pack_time_abs ("execution_time",
- cr->execution_time));
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ cr->execution_time));
}
GNUNET_assert (
0 ==
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
index c7c28a13..c60ba021 100644
--- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
+++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -619,7 +619,7 @@ TMH_post_tips_ID_pickup (const struct TMH_RequestHandler *rh,
struct TALER_Amount total_authorized;
struct TALER_Amount total_picked_up;
struct TALER_Amount total_remaining;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
enum GNUNET_DB_QueryStatus qs;
unsigned int num_retries;
@@ -911,7 +911,7 @@ RETRY:
return reply_lookup_tip_failed (connection,
qs);
}
- if (GNUNET_TIME_absolute_is_past (expiration))
+ if (GNUNET_TIME_absolute_is_past (expiration.abs_time))
{
GNUNET_free (exchange_url);
TMH_db->rollback (TMH_db->cls);
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
index d18ea668..03f799a9 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
@@ -96,7 +96,7 @@ struct ExchangeKycRequest
/**
* Timestamp when we last got a reply from the exchange.
*/
- struct GNUNET_TIME_Absolute last_check;
+ struct GNUNET_TIME_Timestamp last_check;
/**
* Last KYC status returned by the exchange.
@@ -427,10 +427,10 @@ exchange_check_cb (void *cls,
break;
case MHD_HTTP_NO_CONTENT:
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
enum GNUNET_DB_QueryStatus qs;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
qs = TMH_db->account_kyc_set_status (TMH_db->cls,
kc->mi->settings.id,
&ekr->h_wire,
@@ -555,15 +555,17 @@ kyc_status_cb (void *cls,
uint64_t exchange_kyc_serial,
const char *payto_uri,
const char *exchange_url,
- struct GNUNET_TIME_Absolute last_check,
+ struct GNUNET_TIME_Timestamp last_check,
bool kyc_ok)
{
struct KycContext *kc = cls;
struct ExchangeKycRequest *ekr;
if (kyc_ok &&
- (GNUNET_TIME_absolute_get_duration (last_check).rel_value_us <
- STALE_KYC_TIMEOUT.rel_value_us) )
+ (GNUNET_TIME_relative_cmp (
+ GNUNET_TIME_absolute_get_duration (last_check.abs_time),
+ <,
+ STALE_KYC_TIMEOUT)) )
return; /* KYC ok, ignore! */
kc->response_code = MHD_HTTP_ACCEPTED;
ekr = GNUNET_new (struct ExchangeKycRequest);
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 5b2bfeb0..328ffbf0 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -505,10 +505,9 @@ deposit_get_cb (void *cls,
/* got a 'preliminary' reply from the exchange,
remember our target UUID */
enum GNUNET_DB_QueryStatus 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 ();
qs = TMH_db->account_kyc_set_status (
TMH_db->cls,
gorc->hc->instance->settings.id,
@@ -740,7 +739,7 @@ gorc_cleanup (void *cls)
static void
process_refunds_cb (void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
@@ -756,8 +755,8 @@ process_refunds_cb (void *cls,
GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("amount",
refund_amount),
- GNUNET_JSON_pack_time_abs ("timestamp",
- timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ timestamp),
GNUNET_JSON_pack_string ("reason",
reason))));
/* For refunded coins, we are not charged deposit fees, so subtract those
@@ -802,7 +801,7 @@ static void
process_transfer_details (void *cls,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *exchange_url,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const struct TALER_Amount *deposit_value,
const struct TALER_Amount *deposit_fee,
bool transfer_confirmed)
@@ -810,7 +809,6 @@ process_transfer_details (void *cls,
struct GetOrderRequestContext *gorc = cls;
json_t *wire_details = gorc->wire_details;
struct TALER_Amount wired;
- struct GNUNET_TIME_Absolute execution_time_round = execution_time;
/* Compute total amount *wired* */
GNUNET_assert (0 <
@@ -822,7 +820,6 @@ process_transfer_details (void *cls,
&gorc->deposit_fees_total,
deposit_fee));
- GNUNET_TIME_round_abs (&execution_time_round);
GNUNET_assert
(0 <= TALER_amount_subtract (&wired,
deposit_value,
@@ -837,8 +834,8 @@ process_transfer_details (void *cls,
exchange_url),
TALER_JSON_pack_amount ("amount",
&wired),
- GNUNET_JSON_pack_time_abs ("execution_time",
- execution_time_round),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ execution_time),
GNUNET_JSON_pack_bool ("confirmed",
transfer_confirmed))));
}
@@ -856,7 +853,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
bool order_only = false;
struct TALER_ClaimTokenP claim_token = { 0 };
const char *summary;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
if (NULL == gorc)
{
@@ -1067,8 +1064,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
&gorc->fulfillment_url)),
GNUNET_JSON_spec_string ("summary",
&summary),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_end ()
};
@@ -1210,8 +1207,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
&gorc->contract_amount),
GNUNET_JSON_pack_string ("summary",
summary),
- GNUNET_JSON_pack_time_abs ("creation_time",
- timestamp));
+ GNUNET_JSON_pack_timestamp ("creation_time",
+ timestamp));
GNUNET_free (taler_pay_uri);
GNUNET_free (already_paid_order_id);
return ret;
@@ -1323,8 +1320,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
&gorc->contract_amount),
GNUNET_JSON_pack_string ("summary",
summary),
- GNUNET_JSON_pack_time_abs ("creation_time",
- timestamp));
+ GNUNET_JSON_pack_timestamp ("creation_time",
+ timestamp));
GNUNET_free (taler_pay_uri);
GNUNET_free (order_status_url);
return ret;
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c b/src/backend/taler-merchant-httpd_private-get-orders.c
index 9546ae06..29b6e65a 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders.c
@@ -241,7 +241,7 @@ cleanup (void *ctx)
static void
process_refunds_cb (void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
@@ -270,7 +270,7 @@ static void
add_order (void *cls,
const char *orig_order_id,
uint64_t order_serial,
- struct GNUNET_TIME_Absolute creation_time)
+ struct GNUNET_TIME_Timestamp creation_time)
{
struct TMH_PendingOrder *po = cls;
json_t *contract_terms = NULL;
@@ -356,13 +356,13 @@ add_order (void *cls,
}
{
- struct GNUNET_TIME_Absolute rd;
+ struct GNUNET_TIME_Timestamp rd;
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount ("amount",
TMH_currency,
&order_amount),
- GNUNET_JSON_spec_absolute_time ("refund_deadline",
- &rd),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &rd),
GNUNET_JSON_spec_string ("summary",
&summary),
GNUNET_JSON_spec_end ()
@@ -380,7 +380,7 @@ add_order (void *cls,
return;
}
- if (GNUNET_TIME_absolute_is_future (rd) &&
+ if (GNUNET_TIME_absolute_is_future (rd.abs_time) &&
paid)
{
struct TALER_Amount refund_amount;
@@ -415,8 +415,8 @@ add_order (void *cls,
order_id),
GNUNET_JSON_pack_uint64 ("row_id",
order_serial),
- GNUNET_JSON_pack_time_abs ("timestamp",
- creation_time),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ creation_time),
TALER_JSON_pack_amount ("amount",
&order_amount),
GNUNET_JSON_pack_string ("summary",
@@ -448,7 +448,7 @@ resume_by_event (void *cls,
struct TMH_PendingOrder *pn;
enum TMH_OrderStateFlags osf;
uint64_t order_serial_id;
- struct GNUNET_TIME_Absolute date;
+ struct GNUNET_TIME_Timestamp date;
if (sizeof (*oce) != extra_size)
{
@@ -457,7 +457,7 @@ resume_by_event (void *cls,
}
osf = (enum TMH_OrderStateFlags) ntohl (oce->order_state);
order_serial_id = GNUNET_ntohll (oce->order_serial_id);
- date = GNUNET_TIME_absolute_ntoh (oce->execution_date);
+ date = GNUNET_TIME_timestamp_ntoh (oce->execution_date);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received notification about new order %llu\n",
(unsigned long long) order_serial_id);
@@ -490,7 +490,9 @@ resume_by_event (void *cls,
po);
continue;
}
- if (date.abs_value_us < po->of.date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (date,
+ <,
+ po->of.date))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Client %p waits on different order date\n",
@@ -508,7 +510,9 @@ resume_by_event (void *cls,
po);
continue;
}
- if (date.abs_value_us > po->of.date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (date,
+ >,
+ po->of.date))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Client %p waits on different order date\n",
@@ -555,12 +559,12 @@ resume_by_event (void *cls,
void
TMH_notify_order_change (struct TMH_MerchantInstance *mi,
enum TMH_OrderStateFlags osf,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
uint64_t order_serial_id)
{
struct TMH_OrderChangeEventDetailsP oce = {
.order_serial_id = GNUNET_htonll (order_serial_id),
- .execution_date = GNUNET_TIME_absolute_hton (date),
+ .execution_date = GNUNET_TIME_timestamp_hton (date),
.order_state = htonl (osf)
};
struct TMH_OrderChangeEventP eh = {
@@ -679,6 +683,7 @@ TMH_private_get_orders (const struct TMH_RequestHandler *rh,
}
}
}
+ // FIXME: use date_s, as we round to seconds anyway!
{
const char *date_ms_str;
@@ -688,9 +693,9 @@ TMH_private_get_orders (const struct TMH_RequestHandler *rh,
if (NULL == date_ms_str)
{
if (of.delta > 0)
- of.date = GNUNET_TIME_UNIT_ZERO_ABS;
+ of.date = GNUNET_TIME_UNIT_ZERO_TS;
else
- of.date = GNUNET_TIME_UNIT_FOREVER_ABS;
+ of.date = GNUNET_TIME_UNIT_FOREVER_TS;
}
else
{
@@ -710,8 +715,9 @@ TMH_private_get_orders (const struct TMH_RequestHandler *rh,
"date_ms");
}
- of.date = GNUNET_TIME_absolute_from_ms (ll);
- if (GNUNET_TIME_absolute_is_never (of.date))
+ of.date = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_from_ms (ll));
+ if (GNUNET_TIME_absolute_is_never (of.date.abs_time))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.h b/src/backend/taler-merchant-httpd_private-get-orders.h
index 53a20b17..833c9ca4 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders.h
+++ b/src/backend/taler-merchant-httpd_private-get-orders.h
@@ -50,7 +50,7 @@ TMH_private_get_orders (const struct TMH_RequestHandler *rh,
void
TMH_notify_order_change (struct TMH_MerchantInstance *mi,
enum TMH_OrderStateFlags osf,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
uint64_t order_serial_id);
diff --git a/src/backend/taler-merchant-httpd_private-get-products-ID.c b/src/backend/taler-merchant-httpd_private-get-products-ID.c
index 6af8236c..1cff0deb 100644
--- a/src/backend/taler-merchant-httpd_private-get-products-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-products-ID.c
@@ -89,7 +89,7 @@ TMH_private_get_products_ID (const struct TMH_RequestHandler *rh,
GNUNET_JSON_pack_object_steal ("address",
pd.address),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs ("next_restock",
+ GNUNET_JSON_pack_timestamp ("next_restock",
(pd.next_restock))));
GNUNET_free (pd.description);
GNUNET_free (pd.image);
diff --git a/src/backend/taler-merchant-httpd_private-get-reserves-ID.c b/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
index e0cee3a7..5b1481a7 100644
--- a/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
@@ -70,8 +70,8 @@ struct GetReserveContext
*/
static void
handle_reserve_details (void *cls,
- struct GNUNET_TIME_Absolute creation_time,
- struct GNUNET_TIME_Absolute expiration_time,
+ struct GNUNET_TIME_Timestamp creation_time,
+ struct GNUNET_TIME_Timestamp expiration_time,
const struct TALER_Amount *merchant_initial_amount,
const struct TALER_Amount *exchange_initial_amount,
const struct TALER_Amount *picked_up_amount,
@@ -84,11 +84,6 @@ handle_reserve_details (void *cls,
{
struct GetReserveContext *ctx = cls;
json_t *tips_json;
- struct GNUNET_TIME_Absolute creation_time_round = creation_time;
- struct GNUNET_TIME_Absolute expiration_time_round = expiration_time;
-
- GNUNET_TIME_round_abs (&creation_time_round);
- GNUNET_TIME_round_abs (&expiration_time_round);
if (NULL != tips)
{
@@ -115,10 +110,10 @@ handle_reserve_details (void *cls,
ctx->res = TALER_MHD_REPLY_JSON_PACK (
ctx->connection,
MHD_HTTP_OK,
- GNUNET_JSON_pack_time_abs ("creation_time",
- creation_time_round),
- GNUNET_JSON_pack_time_abs ("expiration_time",
- expiration_time_round),
+ GNUNET_JSON_pack_timestamp ("creation_time",
+ creation_time),
+ GNUNET_JSON_pack_timestamp ("expiration_time",
+ expiration_time),
TALER_JSON_pack_amount ("merchant_initial_amount",
merchant_initial_amount),
TALER_JSON_pack_amount ("exchange_initial_amount",
diff --git a/src/backend/taler-merchant-httpd_private-get-reserves.c b/src/backend/taler-merchant-httpd_private-get-reserves.c
index f231a292..be0925d3 100644
--- a/src/backend/taler-merchant-httpd_private-get-reserves.c
+++ b/src/backend/taler-merchant-httpd_private-get-reserves.c
@@ -41,8 +41,8 @@
static void
add_reserve (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
- struct GNUNET_TIME_Absolute creation_time,
- struct GNUNET_TIME_Absolute expiration_time,
+ struct GNUNET_TIME_Timestamp creation_time,
+ struct GNUNET_TIME_Timestamp expiration_time,
const struct TALER_Amount *merchant_initial_amount,
const struct TALER_Amount *exchange_initial_amount,
const struct TALER_Amount *pickup_amount,
@@ -50,21 +50,17 @@ add_reserve (void *cls,
bool active)
{
json_t *pa = cls;
- struct GNUNET_TIME_Absolute creation_time_round = creation_time;
- struct GNUNET_TIME_Absolute expiration_time_round = expiration_time;
- GNUNET_TIME_round_abs (&creation_time_round);
- GNUNET_TIME_round_abs (&expiration_time_round);
GNUNET_assert (0 ==
json_array_append_new (
pa,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("reserve_pub",
reserve_pub),
- GNUNET_JSON_pack_time_abs ("creation_time",
- creation_time_round),
- GNUNET_JSON_pack_time_abs ("expiration_time",
- expiration_time_round),
+ GNUNET_JSON_pack_timestamp ("creation_time",
+ creation_time),
+ GNUNET_JSON_pack_timestamp ("expiration_time",
+ expiration_time),
TALER_JSON_pack_amount ("merchant_initial_amount",
merchant_initial_amount),
TALER_JSON_pack_amount ("exchange_initial_amount",
@@ -93,7 +89,8 @@ TMH_private_get_reserves (const struct TMH_RequestHandler *rh,
{
json_t *ra;
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute created_after = { 0 };
+ struct GNUNET_TIME_Timestamp created_after
+ = GNUNET_TIME_UNIT_ZERO_TS;
enum TALER_EXCHANGE_YesNoAll active;
enum TALER_EXCHANGE_YesNoAll failures;
diff --git a/src/backend/taler-merchant-httpd_private-get-tips-ID.c b/src/backend/taler-merchant-httpd_private-get-tips-ID.c
index ee26f9e5..0460b3c7 100644
--- a/src/backend/taler-merchant-httpd_private-get-tips-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-tips-ID.c
@@ -37,7 +37,7 @@ TMH_private_get_tips_ID (const struct TMH_RequestHandler *rh,
struct TALER_Amount total_authorized;
struct TALER_Amount total_picked_up;
char *reason;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct TALER_ReservePublicKeyP reserve_pub;
unsigned int pickups_length = 0;
struct TALER_MERCHANTDB_PickupDetails *pickups = NULL;
@@ -131,11 +131,8 @@ TMH_private_get_tips_ID (const struct TMH_RequestHandler *rh,
pickups_length,
0);
{
- struct GNUNET_TIME_Absolute expiration_round = expiration;
MHD_RESULT ret;
- GNUNET_TIME_round_abs (&expiration_round);
-
ret = TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_OK,
@@ -145,8 +142,8 @@ TMH_private_get_tips_ID (const struct TMH_RequestHandler *rh,
&total_picked_up),
GNUNET_JSON_pack_string ("reason",
reason),
- GNUNET_JSON_pack_time_abs ("expiration",
- expiration_round),
+ GNUNET_JSON_pack_timestamp ("expiration",
+ expiration),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&reserve_pub),
GNUNET_JSON_pack_allow_null (
diff --git a/src/backend/taler-merchant-httpd_private-get-transfers.c b/src/backend/taler-merchant-httpd_private-get-transfers.c
index c1d243f7..03a7beaa 100644
--- a/src/backend/taler-merchant-httpd_private-get-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-get-transfers.c
@@ -49,7 +49,7 @@ transfer_cb (void *cls,
const char *payto_uri,
const char *exchange_url,
uint64_t transfer_serial_id,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
bool verified,
bool confirmed)
{
@@ -72,11 +72,11 @@ transfer_cb (void *cls,
GNUNET_JSON_pack_bool ("confirmed",
confirmed),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs (
+ GNUNET_JSON_pack_timestamp (
"execution_time",
- GNUNET_TIME_absolute_is_never (execution_time)
- ? GNUNET_TIME_UNIT_ZERO_ABS /* => field omitted */
- : execution_time) ));
+ GNUNET_TIME_absolute_is_never (execution_time.abs_time)
+ ? GNUNET_TIME_UNIT_ZERO_TS /* => field omitted */
+ : execution_time)) );
GNUNET_assert (0 ==
json_array_append_new (ja,
r));
@@ -97,8 +97,8 @@ TMH_private_get_transfers (const struct TMH_RequestHandler *rh,
struct TMH_HandlerContext *hc)
{
const char *payto_uri;
- struct GNUNET_TIME_Absolute before = GNUNET_TIME_UNIT_FOREVER_ABS;
- struct GNUNET_TIME_Absolute after = GNUNET_TIME_UNIT_ZERO_ABS;
+ struct GNUNET_TIME_Timestamp before = GNUNET_TIME_UNIT_FOREVER_TS;
+ struct GNUNET_TIME_Timestamp after = GNUNET_TIME_UNIT_ZERO_TS;
int64_t limit = -20;
uint64_t offset;
enum TALER_EXCHANGE_YesNoAll verified;
@@ -114,8 +114,8 @@ TMH_private_get_transfers (const struct TMH_RequestHandler *rh,
"before");
if ( (NULL != before_s) &&
(GNUNET_OK !=
- GNUNET_STRINGS_fancy_time_to_absolute (before_s,
- &before)) )
+ GNUNET_STRINGS_fancy_time_to_timestamp (before_s,
+ &before)) )
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -129,8 +129,8 @@ TMH_private_get_transfers (const struct TMH_RequestHandler *rh,
"after");
if ( (NULL != after_s) &&
(GNUNET_OK !=
- GNUNET_STRINGS_fancy_time_to_absolute (after_s,
- &after)) )
+ GNUNET_STRINGS_fancy_time_to_timestamp (after_s,
+ &after)) )
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
diff --git a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
index d7ebc1f2..2ea0508b 100644
--- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
@@ -83,10 +83,10 @@ patch_instances_ID (struct TMH_MerchantInstance *mi,
TALER_JSON_spec_amount ("default_max_deposit_fee",
TMH_currency,
&is.default_max_deposit_fee),
- TALER_JSON_spec_relative_time ("default_wire_transfer_delay",
- &is.default_wire_transfer_delay),
- TALER_JSON_spec_relative_time ("default_pay_delay",
- &is.default_pay_delay),
+ GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay",
+ &is.default_wire_transfer_delay),
+ GNUNET_JSON_spec_relative_time ("default_pay_delay",
+ &is.default_pay_delay),
GNUNET_JSON_spec_end ()
};
enum GNUNET_DB_QueryStatus qs;
diff --git a/src/backend/taler-merchant-httpd_private-patch-products-ID.c b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
index b146b31f..13a5c664 100644
--- a/src/backend/taler-merchant-httpd_private-patch-products-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
@@ -142,7 +142,7 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh,
GNUNET_JSON_spec_json ("address",
&pd.address)),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("next_restock",
+ GNUNET_JSON_spec_timestamp ("next_restock",
&pd.next_restock)),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c
index 0ab7fce6..d512d439 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -170,10 +170,10 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
TALER_JSON_spec_amount ("default_max_deposit_fee",
TMH_currency,
&is.default_max_deposit_fee),
- TALER_JSON_spec_relative_time ("default_wire_transfer_delay",
- &is.default_wire_transfer_delay),
- TALER_JSON_spec_relative_time ("default_pay_delay",
- &is.default_pay_delay),
+ GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay",
+ &is.default_wire_transfer_delay),
+ GNUNET_JSON_spec_relative_time ("default_pay_delay",
+ &is.default_pay_delay),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
index 2f98be98..fe120212 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
@@ -156,8 +156,8 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
enum GNUNET_DB_QueryStatus qs;
json_t *contract_terms;
uint64_t order_serial;
- struct GNUNET_TIME_Absolute refund_deadline;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp refund_deadline;
+ struct GNUNET_TIME_Timestamp timestamp;
qs = TMH_db->lookup_contract_terms (TMH_db->cls,
hc->instance->settings.id,
@@ -168,10 +168,10 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_end ()
};
@@ -190,7 +190,9 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
"mandatory fields missing");
}
json_decref (contract_terms);
- if (timestamp.abs_value_us == refund_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (timestamp,
+ ==,
+ refund_deadline))
{
/* refund was never allowed, so we should refuse hard */
return TALER_MHD_reply_with_error (
@@ -199,7 +201,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT,
NULL);
}
- if (GNUNET_TIME_absolute_is_past (refund_deadline))
+ if (GNUNET_TIME_absolute_is_past (refund_deadline.abs_time))
{
/* it is too late for refunds */
/* NOTE: We MAY still be lucky that the exchange did not yet
@@ -335,7 +337,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
}
{
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
uint64_t order_serial;
enum GNUNET_DB_QueryStatus qs;
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index 41b211eb..35cdf790 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -145,7 +145,7 @@ make_merchant_base_url (struct MHD_Connection *connection,
"X-Forwarded-Prefix");
if (NULL != uri_path)
GNUNET_buffer_write_path (&buf, uri_path);
-
+
if (0 != strcmp (instance_id,
"default"))
{
@@ -198,7 +198,7 @@ static enum GNUNET_DB_QueryStatus
execute_transaction (struct TMH_HandlerContext *hc,
const char *order_id,
const struct GNUNET_HashCode *h_post_data,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const json_t *order,
const struct TALER_ClaimTokenP *claim_token,
unsigned int inventory_products_length,
@@ -208,7 +208,7 @@ execute_transaction (struct TMH_HandlerContext *hc,
unsigned int *out_of_stock_index)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
uint64_t order_serial;
if (GNUNET_OK !=
@@ -333,10 +333,10 @@ execute_order (struct MHD_Connection *connection,
json_t *merchant;
json_t *summary_i18n = NULL;
json_t *fulfillment_i18n = NULL;
- struct GNUNET_TIME_Absolute timestamp;
- struct GNUNET_TIME_Absolute refund_deadline = { 0 };
- struct GNUNET_TIME_Absolute wire_transfer_deadline;
- struct GNUNET_TIME_Absolute pay_deadline;
+ struct GNUNET_TIME_Timestamp timestamp;
+ struct GNUNET_TIME_Timestamp refund_deadline = { 0 };
+ struct GNUNET_TIME_Timestamp wire_transfer_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount ("amount",
TMH_currency,
@@ -361,15 +361,15 @@ execute_order (struct MHD_Connection *connection,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("fulfillment_message_i18n",
&fulfillment_i18n)),
- 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)),
- TALER_JSON_spec_absolute_time ("pay_deadline",
- &pay_deadline),
- TALER_JSON_spec_absolute_time ("wire_transfer_deadline",
- &wire_transfer_deadline),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &pay_deadline),
+ GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
+ &wire_transfer_deadline),
GNUNET_JSON_spec_end ()
};
enum GNUNET_DB_QueryStatus qs;
@@ -563,7 +563,7 @@ execute_order (struct MHD_Connection *connection,
"available_quantity",
pd.total_stock - pd.total_sold - pd.total_lost),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs (
+ GNUNET_JSON_pack_timestamp (
"restock_expected",
pd.next_restock)));
TALER_MERCHANTDB_product_details_free (&pd);
@@ -659,13 +659,16 @@ patch_order (struct MHD_Connection *connection,
struct TALER_Amount max_wire_fee = { 0 };
struct TALER_Amount max_fee = { 0 };
uint32_t wire_fee_amortization = 0;
- struct GNUNET_TIME_Absolute timestamp = { 0 };
- struct GNUNET_TIME_Absolute delivery_date = { 0 };
- struct GNUNET_TIME_Absolute refund_deadline
- = GNUNET_TIME_UNIT_FOREVER_ABS;
- struct GNUNET_TIME_Absolute pay_deadline = { 0 };
- struct GNUNET_TIME_Absolute wire_deadline
- = GNUNET_TIME_UNIT_FOREVER_ABS;
+ struct GNUNET_TIME_Timestamp timestamp
+ = GNUNET_TIME_UNIT_ZERO_TS;
+ struct GNUNET_TIME_Timestamp delivery_date
+ = GNUNET_TIME_UNIT_ZERO_TS;
+ struct GNUNET_TIME_Timestamp refund_deadline
+ = GNUNET_TIME_UNIT_FOREVER_TS;
+ struct GNUNET_TIME_Timestamp pay_deadline
+ = GNUNET_TIME_UNIT_ZERO_TS;
+ struct GNUNET_TIME_Timestamp wire_deadline
+ = GNUNET_TIME_UNIT_FOREVER_TS;
/* auto_refund only needs to be type-checked,
* mostly because in GNUnet relative times can't
* be negative. */
@@ -684,17 +687,17 @@ patch_order (struct MHD_Connection *connection,
GNUNET_JSON_spec_string ("fulfillment_url",
&fulfillment_url)),
GNUNET_JSON_spec_mark_optional (
- 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_mark_optional (
- TALER_JSON_spec_absolute_time ("pay_deadline",
- &pay_deadline)),
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &pay_deadline)),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("wire_transfer_deadline",
- &wire_deadline)),
+ GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
+ &wire_deadline)),
GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_amount ("max_fee",
TMH_currency,
@@ -707,11 +710,11 @@ patch_order (struct MHD_Connection *connection,
GNUNET_JSON_spec_uint32 ("wire_fee_amortization",
&wire_fee_amortization)),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("delivery_date",
- &delivery_date)),
+ GNUNET_JSON_spec_timestamp ("delivery_date",
+ &delivery_date)),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_relative_time ("auto_refund",
- &auto_refund)),
+ GNUNET_JSON_spec_relative_time ("auto_refund",
+ &auto_refund)),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("delivery_location",
&delivery_location)),
@@ -825,20 +828,19 @@ patch_order (struct MHD_Connection *connection,
/* Check soundness of refund deadline, and that a timestamp
* is actually present. */
{
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* Add timestamp if it doesn't exist (or is zero) */
- if (0 == timestamp.abs_value_us)
+ if (GNUNET_TIME_absolute_is_zero (timestamp.abs_time))
{
GNUNET_assert (0 ==
json_object_set_new (order,
"timestamp",
- GNUNET_JSON_from_time_abs (now)));
+ GNUNET_JSON_from_timestamp (now)));
}
/* If no refund_deadline given, set one based on refund_delay. */
- if (GNUNET_TIME_absolute_is_never (refund_deadline))
+ if (GNUNET_TIME_absolute_is_never (refund_deadline.abs_time))
{
if (GNUNET_TIME_relative_is_zero (refund_delay))
{
@@ -848,18 +850,19 @@ patch_order (struct MHD_Connection *connection,
}
else
{
- refund_deadline = GNUNET_TIME_relative_to_absolute (refund_delay);
- (void) GNUNET_TIME_round_abs (&refund_deadline);
+ refund_deadline = GNUNET_TIME_relative_to_timestamp (refund_delay);
}
GNUNET_assert (0 ==
json_object_set_new (order,
"refund_deadline",
- GNUNET_JSON_from_time_abs (
+ GNUNET_JSON_from_timestamp (
refund_deadline)));
}
- if ((0 != delivery_date.abs_value_us) &&
- (delivery_date.abs_value_us < now.abs_value_us) )
+ if ( (! GNUNET_TIME_absolute_is_zero (delivery_date.abs_time)) &&
+ (GNUNET_TIME_timestamp_cmp (delivery_date,
+ <,
+ now)) )
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
@@ -870,35 +873,35 @@ patch_order (struct MHD_Connection *connection,
}
}
- if (0 == pay_deadline.abs_value_us)
+ if (GNUNET_TIME_absolute_is_zero (pay_deadline.abs_time))
{
- struct GNUNET_TIME_Absolute t;
+ struct GNUNET_TIME_Timestamp t;
- t = GNUNET_TIME_relative_to_absolute (settings->default_pay_delay);
- (void) GNUNET_TIME_round_abs (&t);
+ t = GNUNET_TIME_relative_to_timestamp (settings->default_pay_delay);
GNUNET_assert (0 ==
json_object_set_new (order,
"pay_deadline",
- GNUNET_JSON_from_time_abs (t)));
+ GNUNET_JSON_from_timestamp (t)));
}
- if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == wire_deadline.abs_value_us)
+ if (GNUNET_TIME_absolute_is_never (wire_deadline.abs_time))
{
- struct GNUNET_TIME_Absolute t;
+ struct GNUNET_TIME_Timestamp t;
- t = GNUNET_TIME_relative_to_absolute (
+ t = GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_max (settings->default_wire_transfer_delay,
refund_delay));
- wire_deadline = GNUNET_TIME_absolute_max (refund_deadline,
- t);
- (void) GNUNET_TIME_round_abs (&wire_deadline);
+ wire_deadline = GNUNET_TIME_timestamp_max (refund_deadline,
+ t);
GNUNET_assert (0 ==
json_object_set_new (order,
"wire_transfer_deadline",
- GNUNET_JSON_from_time_abs (
+ GNUNET_JSON_from_timestamp (
wire_deadline)));
}
- if (wire_deadline.abs_value_us < refund_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (wire_deadline,
+ <,
+ refund_deadline))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
@@ -1337,8 +1340,8 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_JSON_spec_json ("order",
&order),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_relative_time ("refund_delay",
- &refund_delay)),
+ GNUNET_JSON_spec_relative_time ("refund_delay",
+ &refund_delay)),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("payment_target",
&payment_target)),
@@ -1367,8 +1370,8 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Refund delay is %s\n",
- GNUNET_STRINGS_relative_time_to_string (refund_delay,
- GNUNET_NO));
+ GNUNET_TIME_relative2s (refund_delay,
+ false));
TMH_db->expire_locks (TMH_db->cls);
if (create_token)
diff --git a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
index 9983b520..184f1d28 100644
--- a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
+++ b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
@@ -43,8 +43,8 @@ TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("lock_uuid",
&uuids),
- TALER_JSON_spec_relative_time ("duration",
- &duration),
+ GNUNET_JSON_spec_relative_time ("duration",
+ &duration),
GNUNET_JSON_spec_uint32 ("quantity",
&quantity),
GNUNET_JSON_spec_end ()
@@ -71,7 +71,7 @@ TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh,
product_id,
&uuid,
quantity,
- GNUNET_TIME_relative_to_absolute (duration));
+ GNUNET_TIME_relative_to_timestamp (duration));
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
diff --git a/src/backend/taler-merchant-httpd_private-post-products.c b/src/backend/taler-merchant-httpd_private-post-products.c
index dfbec969..b8256a80 100644
--- a/src/backend/taler-merchant-httpd_private-post-products.c
+++ b/src/backend/taler-merchant-httpd_private-post-products.c
@@ -65,8 +65,9 @@ products_equal (const struct TALER_MERCHANTDB_ProductDetails *p1,
p2->image)) &&
(1 == json_equal (p1->address,
p2->address)) &&
- (p1->next_restock.abs_value_us ==
- p2->next_restock.abs_value_us) );
+ (GNUNET_TIME_timestamp_cmp (p1->next_restock,
+ ==,
+ p2->next_restock) ) );
}
@@ -105,8 +106,8 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh,
GNUNET_JSON_spec_json ("address",
&pd.address)),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("next_restock",
- &pd.next_restock)),
+ GNUNET_JSON_spec_timestamp ("next_restock",
+ &pd.next_restock)),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
index f9ceede3..1b69fa21 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
@@ -44,7 +44,7 @@ authorize_tip (const struct TMH_RequestHandler *rh,
const struct TALER_ReservePublicKeyP *reserve_pub)
{
enum TALER_ErrorCode ec;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_HashCode tip_id;
const char *justification;
const char *next_url;
@@ -127,7 +127,6 @@ authorize_tip (const struct TMH_RequestHandler *rh,
tip_status_url = TMH_make_tip_status_url (connection,
&tip_id,
hc->instance->settings.id);
- GNUNET_TIME_round_abs (&expiration);
res = TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_OK,
@@ -137,8 +136,8 @@ authorize_tip (const struct TMH_RequestHandler *rh,
taler_tip_uri),
GNUNET_JSON_pack_string ("tip_status_url",
tip_status_url),
- GNUNET_JSON_pack_time_abs ("tip_expiration",
- expiration));
+ GNUNET_JSON_pack_timestamp ("tip_expiration",
+ expiration));
GNUNET_free (taler_tip_uri);
GNUNET_free (tip_status_url);
return res;
diff --git a/src/backend/taler-merchant-httpd_private-post-reserves.c b/src/backend/taler-merchant-httpd_private-post-reserves.c
index be92b7e4..37b887ef 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves.c
@@ -96,7 +96,7 @@ struct PostReserveContext
/**
* When will the reserve expire.
*/
- struct GNUNET_TIME_Absolute reserve_expiration;
+ struct GNUNET_TIME_Timestamp reserve_expiration;
/**
* Which HTTP status should we return?
@@ -251,7 +251,7 @@ handle_exchange (void *cls,
return;
}
rc->reserve_expiration
- = GNUNET_TIME_relative_to_absolute (keys->reserve_closing_delay);
+ = GNUNET_TIME_relative_to_timestamp (keys->reserve_closing_delay);
rc->payto_uri = GNUNET_strdup (payto_uri);
TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c b/src/backend/taler-merchant-httpd_private-post-transfers.c
index 871aa57a..f06f25c0 100644
--- a/src/backend/taler-merchant-httpd_private-post-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-post-transfers.c
@@ -299,8 +299,8 @@ check_transfer (void *cls,
const struct TALER_Amount *refund_fee,
const struct TALER_Amount *wire_fee,
const struct TALER_MerchantWireHash *h_wire,
- struct GNUNET_TIME_Absolute deposit_timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp deposit_timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_ExchangePublicKeyP *exchange_pub)
{
@@ -326,10 +326,10 @@ check_transfer (void *cls,
TALER_EC_MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS),
GNUNET_JSON_pack_string ("exchange_url",
exchange_url),
- GNUNET_JSON_pack_time_abs ("deposit_timestamp",
- deposit_timestamp),
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- refund_deadline),
+ GNUNET_JSON_pack_timestamp ("deposit_timestamp",
+ deposit_timestamp),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ refund_deadline),
GNUNET_JSON_pack_uint64 ("conflict_offset",
ptc->current_offset),
GNUNET_JSON_pack_data_auto ("coin_pub",
@@ -372,14 +372,14 @@ check_transfer (void *cls,
*/
static enum GNUNET_GenericReturnValue
check_wire_fee (struct PostTransfersContext *ptc,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const struct TALER_Amount *wire_fee)
{
struct TALER_Amount expected_fee;
struct TALER_Amount closing_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;
enum GNUNET_DB_QueryStatus qs;
char *wire_method;
@@ -409,7 +409,7 @@ check_wire_fee (struct PostTransfersContext *ptc,
"Failed to find wire fee for `%s' and method `%s' at %s in DB, accepting blindly that the fee is %s\n",
TALER_B2S (&ptc->master_pub),
wire_method,
- GNUNET_STRINGS_absolute_time_to_string (execution_time),
+ GNUNET_TIME_timestamp2s (execution_time),
TALER_amount2s (wire_fee));
GNUNET_free (wire_method);
return GNUNET_NO;
@@ -430,16 +430,16 @@ check_wire_fee (struct PostTransfersContext *ptc,
TALER_EC_MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE),
TALER_JSON_pack_amount ("wire_fee",
wire_fee),
- GNUNET_JSON_pack_time_abs ("execution_time",
- execution_time),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ execution_time),
TALER_JSON_pack_amount ("expected_wire_fee",
&expected_fee),
TALER_JSON_pack_amount ("expected_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 ("master_sig",
&master_sig),
GNUNET_JSON_pack_data_auto ("master_pub",
@@ -969,7 +969,7 @@ TMH_private_post_transfers (const struct TMH_RequestHandler *rh,
/* Check if transfer data is in database, if not, add it. */
for (unsigned int retry = 0; retry<MAX_RETRIES; retry++)
{
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
struct TALER_Amount total_amount;
struct TALER_Amount exchange_amount;
struct TALER_Amount wire_fee;
@@ -1332,8 +1332,8 @@ TMH_private_post_transfers (const struct TMH_RequestHandler *rh,
&total_amount),
TALER_JSON_pack_amount ("wire_fee",
&wire_fee),
- GNUNET_JSON_pack_time_abs ("execution_time",
- execution_time),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ execution_time),
GNUNET_JSON_pack_array_steal ("deposit_sums",
deposit_sums));
} /* end of 'verified == true' (not an 'if'!) */
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 7bdbaf63..1b55ecd6 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -878,7 +878,7 @@ kyc_status_cb (void *cls,
uint64_t kyc_serial;
char *exchange_url;
char *payto_uri;
- struct GNUNET_TIME_Absolute last_check;
+ struct GNUNET_TIME_Timestamp last_check;
uint8_t kyc_ok;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
@@ -889,8 +889,8 @@ kyc_status_cb (void *cls,
&payto_uri),
GNUNET_PQ_result_spec_string ("exchange_url",
&exchange_url),
- GNUNET_PQ_result_spec_absolute_time ("kyc_timestamp",
- &last_check),
+ GNUNET_PQ_result_spec_timestamp ("kyc_timestamp",
+ &last_check),
GNUNET_PQ_result_spec_auto_from_type ("kyc_ok",
&kyc_ok),
GNUNET_PQ_result_spec_end
@@ -1006,7 +1006,7 @@ postgres_account_kyc_set_status (
uint64_t exchange_kyc_serial,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
bool kyc_ok)
{
struct PostgresClosure *pg = cls;
@@ -1016,7 +1016,7 @@ postgres_account_kyc_set_status (
GNUNET_PQ_query_param_auto_from_type (h_wire),
GNUNET_PQ_query_param_string (exchange_url),
GNUNET_PQ_query_param_uint64 (&exchange_kyc_serial),
- GNUNET_PQ_query_param_absolute_time (&timestamp),
+ GNUNET_PQ_query_param_timestamp (&timestamp),
GNUNET_PQ_query_param_auto_from_type (&ok),
exchange_pub
? GNUNET_PQ_query_param_auto_from_type (exchange_pub)
@@ -1028,8 +1028,6 @@ postgres_account_kyc_set_status (
};
check_connection (pg);
- GNUNET_assert (GNUNET_OK ==
- GNUNET_TIME_round_abs (&timestamp));
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"upsert_account_kyc",
params);
@@ -1364,8 +1362,8 @@ postgres_lookup_product (void *cls,
&pd->image),
TALER_PQ_result_spec_json ("address",
&pd->address),
- GNUNET_PQ_result_spec_absolute_time ("next_restock",
- &pd->next_restock),
+ GNUNET_PQ_result_spec_timestamp ("next_restock",
+ &pd->next_restock),
GNUNET_PQ_result_spec_end
};
@@ -1434,7 +1432,7 @@ postgres_insert_product (void *cls,
TALER_PQ_query_param_amount (&pd->price),
GNUNET_PQ_query_param_uint64 (&pd->total_stock),
TALER_PQ_query_param_json (pd->address),
- GNUNET_PQ_query_param_absolute_time (&pd->next_restock),
+ GNUNET_PQ_query_param_timestamp (&pd->next_restock),
GNUNET_PQ_query_param_end
};
@@ -1483,7 +1481,7 @@ postgres_update_product (void *cls,
GNUNET_PQ_query_param_uint64 (&pd->total_stock), /* $10 */
GNUNET_PQ_query_param_uint64 (&pd->total_lost),
TALER_PQ_query_param_json (pd->address),
- GNUNET_PQ_query_param_absolute_time (&pd->next_restock),
+ GNUNET_PQ_query_param_timestamp (&pd->next_restock),
GNUNET_PQ_query_param_end
};
@@ -1520,7 +1518,7 @@ postgres_lock_product (void *cls,
const char *product_id,
const struct GNUNET_Uuid *uuid,
uint64_t quantity,
- struct GNUNET_TIME_Absolute expiration_time)
+ struct GNUNET_TIME_Timestamp expiration_time)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -1528,7 +1526,7 @@ postgres_lock_product (void *cls,
GNUNET_PQ_query_param_string (product_id),
GNUNET_PQ_query_param_auto_from_type (uuid),
GNUNET_PQ_query_param_uint64 (&quantity),
- GNUNET_PQ_query_param_absolute_time (&expiration_time),
+ GNUNET_PQ_query_param_timestamp (&expiration_time),
GNUNET_PQ_query_param_end
};
@@ -1708,7 +1706,7 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_order_summary (void *cls,
const char *instance_id,
const char *order_id,
- struct GNUNET_TIME_Absolute *timestamp,
+ struct GNUNET_TIME_Timestamp *timestamp,
uint64_t *order_serial)
{
struct PostgresClosure *pg = cls;
@@ -1720,8 +1718,8 @@ postgres_lookup_order_summary (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("order_serial",
order_serial),
- GNUNET_PQ_result_spec_absolute_time ("creation_time",
- timestamp),
+ GNUNET_PQ_result_spec_timestamp ("creation_time",
+ timestamp),
GNUNET_PQ_result_spec_end
};
@@ -1774,14 +1772,14 @@ lookup_orders_cb (void *cls,
{
char *order_id;
uint64_t order_serial;
- struct GNUNET_TIME_Absolute ts;
+ struct GNUNET_TIME_Timestamp ts;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_string ("order_id",
&order_id),
GNUNET_PQ_result_spec_uint64 ("order_serial",
&order_serial),
- GNUNET_PQ_result_spec_absolute_time ("creation_time",
- &ts),
+ GNUNET_PQ_result_spec_timestamp ("creation_time",
+ &ts),
GNUNET_PQ_result_spec_end
};
@@ -1833,7 +1831,7 @@ postgres_lookup_orders (void *cls,
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_uint64 (&limit),
GNUNET_PQ_query_param_uint64 (&of->start_row),
- GNUNET_PQ_query_param_absolute_time (&of->date),
+ GNUNET_PQ_query_param_timestamp (&of->date),
GNUNET_PQ_query_param_auto_from_type (&paid),
GNUNET_PQ_query_param_auto_from_type (&refunded),
GNUNET_PQ_query_param_auto_from_type (&wired),
@@ -1884,25 +1882,24 @@ postgres_insert_order (void *cls,
const char *instance_id,
const char *order_id,
const struct GNUNET_HashCode *h_post_data,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const struct TALER_ClaimTokenP *claim_token,
const json_t *contract_terms)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_string (order_id),
- GNUNET_PQ_query_param_absolute_time (&pay_deadline),
+ GNUNET_PQ_query_param_timestamp (&pay_deadline),
GNUNET_PQ_query_param_auto_from_type (claim_token),
GNUNET_PQ_query_param_auto_from_type (h_post_data),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
TALER_PQ_query_param_json (contract_terms),
GNUNET_PQ_query_param_end
};
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"inserting order: order_id: %s, instance_id: %s.\n",
order_id,
@@ -2049,8 +2046,8 @@ postgres_insert_contract_terms (void *cls,
json_t *contract_terms)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute pay_deadline;
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
const char *fulfillment_url;
struct TALER_PrivateContractHash h_contract_terms;
@@ -2064,10 +2061,10 @@ postgres_insert_contract_terms (void *cls,
{
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("pay_deadline",
- &pay_deadline),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline),
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &pay_deadline),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
@@ -2092,8 +2089,8 @@ postgres_insert_contract_terms (void *cls,
GNUNET_PQ_query_param_string (order_id),
TALER_PQ_query_param_json (contract_terms),
GNUNET_PQ_query_param_auto_from_type (&h_contract_terms),
- GNUNET_PQ_query_param_absolute_time (&pay_deadline),
- GNUNET_PQ_query_param_absolute_time (&refund_deadline),
+ GNUNET_PQ_query_param_timestamp (&pay_deadline),
+ GNUNET_PQ_query_param_timestamp (&refund_deadline),
(NULL == fulfillment_url)
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (fulfillment_url),
@@ -2129,8 +2126,8 @@ postgres_update_contract_terms (void *cls,
json_t *contract_terms)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_TIME_Absolute pay_deadline;
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
const char *fulfillment_url = NULL;
struct TALER_PrivateContractHash h_contract_terms;
@@ -2144,10 +2141,10 @@ postgres_update_contract_terms (void *cls,
{
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("pay_deadline",
- &pay_deadline),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline),
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &pay_deadline),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("fulfillment_url",
&fulfillment_url)),
@@ -2172,8 +2169,8 @@ postgres_update_contract_terms (void *cls,
GNUNET_PQ_query_param_string (order_id),
TALER_PQ_query_param_json (contract_terms),
GNUNET_PQ_query_param_auto_from_type (&h_contract_terms),
- GNUNET_PQ_query_param_absolute_time (&pay_deadline),
- GNUNET_PQ_query_param_absolute_time (&refund_deadline),
+ GNUNET_PQ_query_param_timestamp (&pay_deadline),
+ GNUNET_PQ_query_param_timestamp (&refund_deadline),
(NULL == fulfillment_url)
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (fulfillment_url),
@@ -2376,18 +2373,18 @@ postgres_insert_exchange_signkey (
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute expire_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp expire_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterSignatureP *master_sig)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (exchange_pub),
- GNUNET_PQ_query_param_absolute_time (&start_date),
- GNUNET_PQ_query_param_absolute_time (&expire_date),
- GNUNET_PQ_query_param_absolute_time (&end_date),
+ GNUNET_PQ_query_param_timestamp (&start_date),
+ GNUNET_PQ_query_param_timestamp (&expire_date),
+ GNUNET_PQ_query_param_timestamp (&end_date),
GNUNET_PQ_query_param_auto_from_type (master_sig),
GNUNET_PQ_query_param_end
};
@@ -2423,7 +2420,7 @@ static enum GNUNET_DB_QueryStatus
postgres_insert_deposit (
void *cls,
const char *instance_id,
- struct GNUNET_TIME_Absolute deposit_timestamp,
+ struct GNUNET_TIME_Timestamp deposit_timestamp,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
@@ -2439,7 +2436,7 @@ postgres_insert_deposit (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_absolute_time (&deposit_timestamp), /* $3 */
+ GNUNET_PQ_query_param_timestamp (&deposit_timestamp), /* $3 */
GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_string (exchange_url),
TALER_PQ_query_param_amount (amount_with_fee), /* $6/$7 */
@@ -2664,7 +2661,7 @@ static enum GNUNET_DB_QueryStatus
postgres_refund_coin (void *cls,
const char *instance_id,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute refund_timestamp,
+ struct GNUNET_TIME_Timestamp refund_timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *reason)
{
@@ -2672,7 +2669,7 @@ postgres_refund_coin (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
- GNUNET_PQ_query_param_absolute_time (&refund_timestamp),
+ GNUNET_PQ_query_param_timestamp (&refund_timestamp),
GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_string (reason),
GNUNET_PQ_query_param_end
@@ -3026,15 +3023,15 @@ lookup_transfer_details_by_order_cb (void *cls,
struct TALER_WireTransferIdentifierRawP wtid;
char *exchange_url;
uint64_t deposit_serial;
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
struct TALER_Amount deposit_value;
struct TALER_Amount deposit_fee;
uint8_t transfer_confirmed;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("deposit_serial",
&deposit_serial),
- GNUNET_PQ_result_spec_absolute_time ("deposit_timestamp",
- &execution_time),
+ GNUNET_PQ_result_spec_timestamp ("deposit_timestamp",
+ &execution_time),
GNUNET_PQ_result_spec_string ("exchange_url",
&exchange_url),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
@@ -3129,7 +3126,7 @@ postgres_insert_deposit_to_transfer (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&deposit_serial),
TALER_PQ_query_param_amount (&dd->coin_contribution),
- GNUNET_PQ_query_param_absolute_time (&dd->execution_time),
+ GNUNET_PQ_query_param_timestamp (&dd->execution_time),
GNUNET_PQ_query_param_auto_from_type (&dd->exchange_sig),
GNUNET_PQ_query_param_auto_from_type (&dd->exchange_pub),
GNUNET_PQ_query_param_auto_from_type (&dd->wtid),
@@ -3327,10 +3324,9 @@ process_deposits_for_refund_cb (void *cls,
struct PostgresClosure *pg = ctx->pg;
struct TALER_Amount current_refund;
struct RefundCoinData rcd[GNUNET_NZL (num_results)];
- 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_assert (GNUNET_OK ==
TALER_amount_set_zero (ctx->refund->currency,
&current_refund));
@@ -3500,7 +3496,7 @@ process_deposits_for_refund_cb (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&rcd[i].order_serial),
GNUNET_PQ_query_param_uint64 (&rcd[i].max_rtransaction_id), /* already inc'ed */
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_auto_from_type (&rcd[i].coin_pub),
GNUNET_PQ_query_param_string (ctx->reason),
TALER_PQ_query_param_amount (increment),
@@ -3658,7 +3654,7 @@ lookup_refunds_detailed_cb (void *cls,
for (unsigned int i = 0; i<num_results; i++)
{
uint64_t refund_serial;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
struct TALER_CoinSpendPublicKeyP coin_pub;
uint64_t rtransaction_id;
struct TALER_Amount refund_amount;
@@ -3668,8 +3664,8 @@ lookup_refunds_detailed_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("refund_serial",
&refund_serial),
- GNUNET_PQ_result_spec_absolute_time ("refund_timestamp",
- &timestamp),
+ GNUNET_PQ_result_spec_timestamp ("refund_timestamp",
+ &timestamp),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&coin_pub),
GNUNET_PQ_result_spec_string ("exchange_url",
@@ -4088,7 +4084,7 @@ RETRY:
GNUNET_PQ_query_param_uint64 (&credit_serial),
TALER_PQ_query_param_amount (&td->total_amount),
TALER_PQ_query_param_amount (&td->wire_fee),
- GNUNET_PQ_query_param_absolute_time (&td->execution_time),
+ GNUNET_PQ_query_param_timestamp (&td->execution_time),
GNUNET_PQ_query_param_auto_from_type (&td->exchange_sig),
GNUNET_PQ_query_param_auto_from_type (&td->exchange_pub),
GNUNET_PQ_query_param_end
@@ -4221,11 +4217,11 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_wire_fee (void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const char *wire_method,
- struct GNUNET_TIME_Absolute contract_date,
+ struct GNUNET_TIME_Timestamp contract_date,
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 TALER_MasterSignatureP *master_sig)
{
struct PostgresClosure *pg = cls;
@@ -4233,7 +4229,7 @@ postgres_lookup_wire_fee (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (&h_wire_method),
- GNUNET_PQ_query_param_absolute_time (&contract_date),
+ GNUNET_PQ_query_param_timestamp (&contract_date),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -4241,10 +4237,10 @@ postgres_lookup_wire_fee (void *cls,
wire_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
closing_fee),
- GNUNET_PQ_result_spec_absolute_time ("start_date",
- start_date),
- GNUNET_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
@@ -4312,8 +4308,8 @@ lookup_deposits_by_contract_and_coin_cb (void *cls,
struct TALER_Amount refund_fee;
struct TALER_Amount wire_fee;
struct TALER_MerchantWireHash h_wire;
- struct GNUNET_TIME_Absolute deposit_timestamp;
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp deposit_timestamp;
+ struct GNUNET_TIME_Timestamp refund_deadline;
struct TALER_ExchangeSignatureP exchange_sig;
struct TALER_ExchangePublicKeyP exchange_pub;
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -4329,10 +4325,10 @@ lookup_deposits_by_contract_and_coin_cb (void *cls,
&wire_fee),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&h_wire),
- GNUNET_PQ_result_spec_absolute_time ("deposit_timestamp",
- &deposit_timestamp),
- GNUNET_PQ_result_spec_absolute_time ("refund_deadline",
- &refund_deadline),
+ GNUNET_PQ_result_spec_timestamp ("deposit_timestamp",
+ &deposit_timestamp),
+ GNUNET_PQ_result_spec_timestamp ("refund_deadline",
+ &refund_deadline),
GNUNET_PQ_result_spec_auto_from_type ("exchange_sig",
&exchange_sig),
GNUNET_PQ_result_spec_auto_from_type ("exchange_pub",
@@ -4440,7 +4436,7 @@ postgres_lookup_transfer (
struct TALER_Amount *total_amount,
struct TALER_Amount *wire_fee,
struct TALER_Amount *exchange_amount,
- struct GNUNET_TIME_Absolute *execution_time,
+ struct GNUNET_TIME_Timestamp *execution_time,
bool *have_exchange_sig,
bool *verified)
{
@@ -4467,8 +4463,8 @@ postgres_lookup_transfer (
exchange_amount),
NULL),
GNUNET_PQ_result_spec_allow_null (
- GNUNET_PQ_result_spec_absolute_time ("execution_time",
- execution_time),
+ GNUNET_PQ_result_spec_timestamp ("execution_time",
+ execution_time),
NULL),
GNUNET_PQ_result_spec_auto_from_type ("verified",
&verified8),
@@ -4477,7 +4473,7 @@ postgres_lookup_transfer (
enum GNUNET_DB_QueryStatus qs;
check_connection (pg);
- *execution_time = GNUNET_TIME_UNIT_ZERO_ABS;
+ *execution_time = GNUNET_TIME_UNIT_ZERO_TS;
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"lookup_transfer",
params,
@@ -4836,7 +4832,7 @@ lookup_transfers_cb (void *cls,
char *payto_uri;
char *exchange_url;
uint64_t transfer_serial_id;
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
enum TALER_EXCHANGE_YesNoAll verified;
uint8_t verified8;
uint8_t confirmed8;
@@ -4851,8 +4847,8 @@ lookup_transfers_cb (void *cls,
&exchange_url),
GNUNET_PQ_result_spec_uint64 ("credit_serial",
&transfer_serial_id),
- GNUNET_PQ_result_spec_absolute_time ("execution_time",
- &execution_time),
+ GNUNET_PQ_result_spec_timestamp ("execution_time",
+ &execution_time),
GNUNET_PQ_result_spec_auto_from_type ("verified",
&verified8),
GNUNET_PQ_result_spec_auto_from_type ("confirmed",
@@ -4916,8 +4912,8 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_transfers (void *cls,
const char *instance_id,
const char *payto_uri,
- struct GNUNET_TIME_Absolute before,
- struct GNUNET_TIME_Absolute after,
+ struct GNUNET_TIME_Timestamp before,
+ struct GNUNET_TIME_Timestamp after,
int64_t limit,
uint64_t offset,
enum TALER_EXCHANGE_YesNoAll verified,
@@ -4935,10 +4931,8 @@ postgres_lookup_transfers (void *cls,
enum GNUNET_DB_QueryStatus qs;
bool by_time;
- by_time = ( (before.abs_value_us !=
- GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) ||
- (after.abs_value_us !=
- GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us) );
+ by_time = ( (! GNUNET_TIME_absolute_is_never (before.abs_time)) ||
+ (! GNUNET_TIME_absolute_is_zero (after.abs_time)) );
check_connection (pg);
if (by_time)
{
@@ -4946,8 +4940,8 @@ postgres_lookup_transfers (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_absolute_time (&before),
- GNUNET_PQ_query_param_absolute_time (&after),
+ GNUNET_PQ_query_param_timestamp (&before),
+ GNUNET_PQ_query_param_timestamp (&after),
GNUNET_PQ_query_param_uint64 (&offset),
GNUNET_PQ_query_param_uint64 (&plimit),
GNUNET_PQ_query_param_string (payto_uri),
@@ -4967,8 +4961,8 @@ postgres_lookup_transfers (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_absolute_time (&before),
- GNUNET_PQ_query_param_absolute_time (&after),
+ GNUNET_PQ_query_param_timestamp (&before),
+ GNUNET_PQ_query_param_timestamp (&after),
GNUNET_PQ_query_param_uint64 (&offset),
GNUNET_PQ_query_param_uint64 (&plimit),
GNUNET_PQ_query_param_end
@@ -5052,8 +5046,8 @@ postgres_store_wire_fee_by_exchange (
const struct GNUNET_HashCode *h_wire_method,
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)
{
struct PostgresClosure *pg = cls;
@@ -5062,8 +5056,8 @@ postgres_store_wire_fee_by_exchange (
GNUNET_PQ_query_param_auto_from_type (h_wire_method),
TALER_PQ_query_param_amount (wire_fee),
TALER_PQ_query_param_amount (closing_fee),
- GNUNET_PQ_query_param_absolute_time (&start_date),
- GNUNET_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_auto_from_type (master_sig),
GNUNET_PQ_query_param_end
};
@@ -5073,7 +5067,7 @@ postgres_store_wire_fee_by_exchange (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Storing wire fee for %s starting at %s of %s\n",
TALER_B2S (master_pub),
- GNUNET_STRINGS_absolute_time_to_string (start_date),
+ GNUNET_TIME_timestamp2s (start_date),
TALER_amount2s (wire_fee));
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_wire_fee",
@@ -5107,7 +5101,7 @@ postgres_insert_reserve (void *cls,
const char *exchange_url,
const char *payto_uri,
const struct TALER_Amount *initial_balance,
- struct GNUNET_TIME_Absolute expiration)
+ struct GNUNET_TIME_Timestamp expiration)
{
struct PostgresClosure *pg = cls;
unsigned int retries;
@@ -5128,18 +5122,17 @@ RETRY:
/* Setup reserve */
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
- GNUNET_PQ_query_param_absolute_time (&now),
- GNUNET_PQ_query_param_absolute_time (&expiration),
+ GNUNET_PQ_query_param_timestamp (&now),
+ GNUNET_PQ_query_param_timestamp (&expiration),
TALER_PQ_query_param_amount (initial_balance),
GNUNET_PQ_query_param_end
};
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_reserve",
params);
@@ -5273,8 +5266,8 @@ lookup_reserves_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
struct TALER_ReservePublicKeyP reserve_pub;
- struct GNUNET_TIME_Absolute creation_time;
- struct GNUNET_TIME_Absolute expiration_time;
+ struct GNUNET_TIME_Timestamp creation_time;
+ struct GNUNET_TIME_Timestamp expiration_time;
struct TALER_Amount merchant_initial_balance;
struct TALER_Amount exchange_initial_balance;
struct TALER_Amount pickup_amount;
@@ -5283,10 +5276,10 @@ lookup_reserves_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
- GNUNET_PQ_result_spec_absolute_time ("creation_time",
- &creation_time),
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- &expiration_time),
+ GNUNET_PQ_result_spec_timestamp ("creation_time",
+ &creation_time),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ &expiration_time),
TALER_PQ_RESULT_SPEC_AMOUNT ("merchant_initial_balance",
&merchant_initial_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
@@ -5367,7 +5360,7 @@ lookup_reserves_cb (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_lookup_reserves (void *cls,
const char *instance_id,
- struct GNUNET_TIME_Absolute created_after,
+ struct GNUNET_TIME_Timestamp created_after,
enum TALER_EXCHANGE_YesNoAll active,
enum TALER_EXCHANGE_YesNoAll failures,
TALER_MERCHANTDB_ReservesCallback cb,
@@ -5383,7 +5376,7 @@ postgres_lookup_reserves (void *cls,
};
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_absolute_time (&created_after),
+ GNUNET_PQ_query_param_timestamp (&created_after),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -5618,8 +5611,8 @@ postgres_lookup_reserve (void *cls,
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_end
};
- struct GNUNET_TIME_Absolute creation_time;
- struct GNUNET_TIME_Absolute expiration_time;
+ struct GNUNET_TIME_Timestamp creation_time;
+ struct GNUNET_TIME_Timestamp expiration_time;
struct TALER_Amount merchant_initial_balance;
struct TALER_Amount exchange_initial_balance;
struct TALER_Amount pickup_amount;
@@ -5628,10 +5621,10 @@ postgres_lookup_reserve (void *cls,
char *exchange_url = NULL;
char *payto_uri = NULL;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("creation_time",
- &creation_time),
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- &expiration_time),
+ GNUNET_PQ_result_spec_timestamp ("creation_time",
+ &creation_time),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ &expiration_time),
TALER_PQ_RESULT_SPEC_AMOUNT ("merchant_initial_balance",
&merchant_initial_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
@@ -5791,7 +5784,7 @@ struct LookupReserveForTipContext
* Set to the expiration time of the reserve we found.
* #GNUNET_TIME_UNIT_FOREVER_ABS if we found none.
*/
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
/**
* Error status.
@@ -5834,7 +5827,7 @@ lookup_reserve_for_tip_cb (void *cls,
struct TALER_Amount committed_amount;
struct TALER_Amount remaining;
struct TALER_Amount initial_balance;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
@@ -5842,8 +5835,8 @@ lookup_reserve_for_tip_cb (void *cls,
&initial_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("tips_committed",
&committed_amount),
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- &expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ &expiration),
GNUNET_PQ_result_spec_end
};
@@ -5874,11 +5867,12 @@ lookup_reserve_for_tip_cb (void *cls,
lac->ec = TALER_EC_MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_INSUFFICIENT_FUNDS;
continue;
}
- if ( (lac->expiration.abs_value_us !=
- GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) &&
- ( (expiration.abs_value_us > lac->expiration.abs_value_us) &&
- (GNUNET_TIME_absolute_get_remaining (lac->expiration).rel_value_us >
- MIN_EXPIRATION.rel_value_us) ) )
+ if ( (! GNUNET_TIME_absolute_is_never (lac->expiration.abs_time)) &&
+ GNUNET_TIME_timestamp_cmp (expiration, >, lac->expiration) &&
+ GNUNET_TIME_relative_cmp (
+ GNUNET_TIME_absolute_get_remaining (lac->expiration.abs_time),
+ >,
+ MIN_EXPIRATION) )
{
/* reserve expired */
if (lac->ok)
@@ -5926,7 +5920,7 @@ postgres_authorize_tip (void *cls,
const char *justification,
const char *next_url,
struct GNUNET_HashCode *tip_id,
- struct GNUNET_TIME_Absolute *expiration)
+ struct GNUNET_TIME_Timestamp *expiration)
{
struct PostgresClosure *pg = cls;
unsigned int retries = 0;
@@ -5937,7 +5931,7 @@ postgres_authorize_tip (void *cls,
struct LookupReserveForTipContext lac = {
.pg = pg,
.required_amount = *amount,
- .expiration = GNUNET_TIME_UNIT_FOREVER_ABS
+ .expiration = GNUNET_TIME_UNIT_FOREVER_TS
};
check_connection (pg);
@@ -5997,8 +5991,8 @@ RETRY:
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ expiration),
TALER_PQ_RESULT_SPEC_AMOUNT ("tips_committed",
&tips_committed),
TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
@@ -6086,7 +6080,7 @@ RETRY:
GNUNET_PQ_query_param_auto_from_type (tip_id),
GNUNET_PQ_query_param_string (justification),
GNUNET_PQ_query_param_string (next_url),
- GNUNET_PQ_query_param_absolute_time (expiration),
+ GNUNET_PQ_query_param_timestamp (expiration),
TALER_PQ_query_param_amount (amount),
GNUNET_PQ_query_param_end
};
@@ -6275,7 +6269,7 @@ postgres_lookup_tip (void *cls,
const struct GNUNET_HashCode *tip_id,
struct TALER_Amount *total_authorized,
struct TALER_Amount *total_picked_up,
- struct GNUNET_TIME_Absolute *expiration,
+ struct GNUNET_TIME_Timestamp *expiration,
char **exchange_url,
struct TALER_ReservePrivateKeyP *reserve_priv)
{
@@ -6290,8 +6284,8 @@ postgres_lookup_tip (void *cls,
total_authorized),
TALER_PQ_RESULT_SPEC_AMOUNT ("picked_up",
total_picked_up),
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ expiration),
GNUNET_PQ_result_spec_string ("exchange_url",
exchange_url),
GNUNET_PQ_result_spec_auto_from_type ("reserve_priv",
@@ -6544,7 +6538,7 @@ postgres_lookup_tip_details (void *cls,
struct TALER_Amount *total_authorized,
struct TALER_Amount *total_picked_up,
char **justification,
- struct GNUNET_TIME_Absolute *expiration,
+ struct GNUNET_TIME_Timestamp *expiration,
struct TALER_ReservePublicKeyP *reserve_pub,
unsigned int *pickups_length,
struct TALER_MERCHANTDB_PickupDetails **pickups)
@@ -6567,8 +6561,8 @@ postgres_lookup_tip_details (void *cls,
total_picked_up),
GNUNET_PQ_result_spec_string ("justification",
justification),
- GNUNET_PQ_result_spec_absolute_time ("expiration",
- expiration),
+ GNUNET_PQ_result_spec_timestamp ("expiration",
+ expiration),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
reserve_pub),
GNUNET_PQ_result_spec_end
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 1fbe0e65..d6d490b6 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -761,7 +761,7 @@ make_product (const char *id,
GNUNET_assert (NULL != product->product.image);
product->product.address = json_array ();
GNUNET_assert (NULL != product->product.address);
- product->product.next_restock = GNUNET_TIME_absolute_get_zero_ ();
+ product->product.next_restock = GNUNET_TIME_UNIT_ZERO_TS;
}
@@ -797,8 +797,9 @@ check_products_equal (const struct TALER_MERCHANTDB_ProductDetails *a,
b->description_i18n)) ||
(0 != strcmp (a->unit,
b->unit)) ||
- (GNUNET_OK != TALER_amount_cmp_currency (&a->price,
- &b->price)) ||
+ (GNUNET_OK !=
+ TALER_amount_cmp_currency (&a->price,
+ &b->price)) ||
(0 != TALER_amount_cmp (&a->price,
&b->price)) ||
(1 != json_equal (a->taxes,
@@ -810,7 +811,9 @@ check_products_equal (const struct TALER_MERCHANTDB_ProductDetails *a,
b->image)) ||
(1 != json_equal (a->address,
b->address)) ||
- (a->next_restock.abs_value_us != b->next_restock.abs_value_us))
+ (GNUNET_TIME_timestamp_cmp (a->next_restock,
+ !=,
+ b->next_restock)))
return 1;
return 0;
}
@@ -1088,9 +1091,8 @@ static int
run_test_products (struct TestProducts_Closure *cls)
{
struct GNUNET_Uuid uuid;
- struct GNUNET_TIME_Absolute refund_deadline =
- GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- GNUNET_TIME_UNIT_WEEKS);
+ struct GNUNET_TIME_Timestamp refund_deadline =
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_WEEKS);
/* Test that insert without an instance fails */
TEST_RET_ON_FAIL (test_insert_product (&cls->instance,
@@ -1144,7 +1146,7 @@ run_test_products (struct TestProducts_Closure *cls)
GNUNET_assert (0 ==
json_array_append_new (cls->products[0].product.address,
json_string ("444 Some Street")));
- cls->products[0].product.next_restock = GNUNET_TIME_absolute_get ();
+ cls->products[0].product.next_restock = GNUNET_TIME_timestamp_get ();
TEST_RET_ON_FAIL (test_update_product (&cls->instance,
&cls->products[0],
GNUNET_DB_STATUS_SUCCESS_ONE_RESULT));
@@ -1269,7 +1271,7 @@ struct OrderData
/**
* The pay deadline for the order
*/
- struct GNUNET_TIME_Absolute pay_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
/**
* The contract of the order
@@ -1293,20 +1295,17 @@ static void
make_order (const char *order_id,
struct OrderData *order)
{
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
order->id = order_id;
order->contract = json_object ();
GNUNET_assert (NULL != order->contract);
- order->pay_deadline = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- GNUNET_TIME_UNIT_DAYS);
+ order->pay_deadline = GNUNET_TIME_relative_to_timestamp (
+ GNUNET_TIME_UNIT_DAYS);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
&order->claim_token,
sizeof (order->claim_token));
- refund_deadline = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- GNUNET_TIME_UNIT_WEEKS);
- GNUNET_TIME_round_abs (&order->pay_deadline);
- GNUNET_TIME_round_abs (&refund_deadline);
+ refund_deadline = GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_WEEKS);
json_object_set_new (order->contract,
"fulfillment_url",
json_string ("a"));
@@ -1315,10 +1314,10 @@ make_order (const char *order_id,
json_string (order_id));
json_object_set_new (order->contract,
"pay_deadline",
- GNUNET_JSON_from_time_abs (order->pay_deadline));
+ GNUNET_JSON_from_timestamp (order->pay_deadline));
json_object_set_new (order->contract,
"refund_deadline",
- GNUNET_JSON_from_time_abs (refund_deadline));
+ GNUNET_JSON_from_timestamp (refund_deadline));
}
@@ -1455,7 +1454,7 @@ static void
lookup_orders_cb (void *cls,
const char *order_id,
uint64_t order_serial,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct TestLookupOrders_Closure *cmp = cls;
if (NULL == cmp)
@@ -1559,7 +1558,7 @@ static void
get_order_serial_cb (void *cls,
const char *order_id,
uint64_t order_serial,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct LookupOrderSerial_Closure *lookup_cls = cls;
if (NULL == lookup_cls)
@@ -1589,7 +1588,7 @@ get_order_serial (const struct InstanceData *instance,
.paid = TALER_EXCHANGE_YNA_ALL,
.refunded = TALER_EXCHANGE_YNA_ALL,
.wired = TALER_EXCHANGE_YNA_ALL,
- .date = GNUNET_TIME_UNIT_ZERO_ABS,
+ .date = GNUNET_TIME_UNIT_ZERO_TS,
.start_row = 0,
.delta = 256
};
@@ -1956,12 +1955,12 @@ pre_test_orders (struct TestOrders_Closure *cls)
"other_field",
json_string ("Second contract")));
- cls->orders[2].pay_deadline = GNUNET_TIME_UNIT_ZERO_ABS;
+ cls->orders[2].pay_deadline = GNUNET_TIME_UNIT_ZERO_TS;
GNUNET_assert (0 ==
json_object_set_new (
cls->orders[2].contract,
"pay_deadline",
- GNUNET_JSON_from_time_abs (cls->orders[2].pay_deadline)));
+ GNUNET_JSON_from_timestamp (cls->orders[2].pay_deadline)));
}
@@ -1994,7 +1993,7 @@ run_test_orders (struct TestOrders_Closure *cls)
.paid = TALER_EXCHANGE_YNA_ALL,
.refunded = TALER_EXCHANGE_YNA_ALL,
.wired = TALER_EXCHANGE_YNA_ALL,
- .date = GNUNET_TIME_absolute_get_zero_ (),
+ .date = GNUNET_TIME_UNIT_ZERO_TS,
.start_row = 0,
.delta = 8
};
@@ -2309,17 +2308,17 @@ struct ExchangeSignkeyData
/**
* When the signing key becomes valid.
*/
- struct GNUNET_TIME_Absolute start_date;
+ struct GNUNET_TIME_Timestamp start_date;
/**
* When the signing key stops being used.
*/
- struct GNUNET_TIME_Absolute expire_date;
+ struct GNUNET_TIME_Timestamp expire_date;
/**
* When the signing key becomes invalid for proof.
*/
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp end_date;
};
@@ -2349,9 +2348,9 @@ make_exchange_signkey (struct ExchangeSignkeyData *signkey)
GNUNET_CRYPTO_eddsa_sign (&signkey->master_priv.eddsa_priv,
&exch_sign,
&signkey->master_sig.eddsa_signature);
- signkey->start_date = GNUNET_TIME_absolute_get ();
- signkey->expire_date = GNUNET_TIME_absolute_get ();
- signkey->end_date = GNUNET_TIME_absolute_get ();
+ signkey->start_date = GNUNET_TIME_timestamp_get ();
+ signkey->expire_date = GNUNET_TIME_timestamp_get ();
+ signkey->end_date = GNUNET_TIME_timestamp_get ();
}
@@ -2363,7 +2362,7 @@ struct DepositData
/**
* When the deposit was made.
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Hash of the associated order's contract terms.
@@ -2436,7 +2435,7 @@ make_deposit (const struct InstanceData *instance,
};
struct TALER_Amount amount_without_fee;
- deposit->timestamp = GNUNET_TIME_absolute_get ();
+ deposit->timestamp = GNUNET_TIME_timestamp_get ();
GNUNET_assert (GNUNET_OK ==
TALER_JSON_contract_hash (order->contract,
&deposit->h_contract_terms));
@@ -2463,12 +2462,12 @@ make_deposit (const struct InstanceData *instance,
deposit->h_wire = account->h_wire;
deposit_sign.h_contract_terms = deposit->h_contract_terms;
deposit_sign.h_wire = deposit->h_wire;
- deposit_sign.exchange_timestamp = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_get ());
- deposit_sign.wire_deadline = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_get ());
- deposit_sign.refund_deadline = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_get ());
+ deposit_sign.exchange_timestamp = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_timestamp_get ());
+ deposit_sign.wire_deadline = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_timestamp_get ());
+ deposit_sign.refund_deadline = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_timestamp_get ());
TALER_amount_hton (&deposit_sign.amount_without_fee,
&amount_without_fee);
deposit_sign.merchant_pub = instance->merchant_pub;
@@ -2701,8 +2700,8 @@ lookup_deposits_contract_coin_cb (
const struct TALER_Amount *refund_fee,
const struct TALER_Amount *wire_fee,
const struct TALER_MerchantWireHash *h_wire,
- struct GNUNET_TIME_Absolute deposit_timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp deposit_timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_ExchangePublicKeyP *exchange_pub)
{
@@ -2713,8 +2712,9 @@ lookup_deposits_contract_coin_cb (
cmp->results_length += 1;
for (unsigned int i = 0; cmp->deposits_to_cmp_length > i; ++i)
{
- if ((cmp->deposits_to_cmp[i].timestamp.abs_value_us ==
- deposit_timestamp.abs_value_us) &&
+ if ((GNUNET_TIME_timestamp_cmp (cmp->deposits_to_cmp[i].timestamp,
+ ==,
+ deposit_timestamp)) &&
(0 == strcmp (cmp->deposits_to_cmp[i].exchange_url,
exchange_url)) &&
(GNUNET_OK == TALER_amount_cmp_currency (
@@ -3231,12 +3231,12 @@ struct WireFeeData
/**
* Start date of the wire fee.
*/
- struct GNUNET_TIME_Absolute wire_fee_start;
+ struct GNUNET_TIME_Timestamp wire_fee_start;
/**
* End date of the wire fee.
*/
- struct GNUNET_TIME_Absolute wire_fee_end;
+ struct GNUNET_TIME_Timestamp wire_fee_end;
/**
* Signature on the wire fee.
@@ -3274,16 +3274,16 @@ make_wire_fee (const struct ExchangeSignkeyData *signkey,
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:0.49",
&wire_fee->closing_fee));
- wire_fee->wire_fee_start = GNUNET_TIME_absolute_get ();
- wire_fee->wire_fee_end = GNUNET_TIME_absolute_add (wire_fee->wire_fee_start,
- GNUNET_TIME_UNIT_MONTHS);
+ wire_fee->wire_fee_start = GNUNET_TIME_timestamp_get ();
+ wire_fee->wire_fee_end = GNUNET_TIME_relative_to_timestamp (
+ GNUNET_TIME_UNIT_MONTHS);
fee_sign.h_wire_method = wire_fee->h_wire_method;
TALER_amount_hton (&fee_sign.wire_fee,
&wire_fee->wire_fee);
TALER_amount_hton (&fee_sign.closing_fee,
&wire_fee->closing_fee);
- fee_sign.start_date = GNUNET_TIME_absolute_hton (wire_fee->wire_fee_start);
- fee_sign.end_date = GNUNET_TIME_absolute_hton (wire_fee->wire_fee_end);
+ fee_sign.start_date = GNUNET_TIME_timestamp_hton (wire_fee->wire_fee_start);
+ fee_sign.end_date = GNUNET_TIME_timestamp_hton (wire_fee->wire_fee_end);
GNUNET_CRYPTO_eddsa_sign (&signkey->master_priv.eddsa_priv,
&fee_sign,
&wire_fee->fee_sig.eddsa_signature);
@@ -3376,7 +3376,7 @@ make_transfer (const struct ExchangeSignkeyData *signkey,
&deposits[i].deposit_fee));
}
transfer->data.exchange_pub = signkey->exchange_pub;
- transfer->data.execution_time = GNUNET_TIME_absolute_get ();
+ transfer->data.execution_time = GNUNET_TIME_timestamp_get ();
transfer->data.details = details;
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:0.50",
@@ -3404,7 +3404,7 @@ test_lookup_transfer (
struct TALER_Amount total;
struct TALER_Amount fee;
struct TALER_Amount exchange_amount;
- struct GNUNET_TIME_Absolute time;
+ struct GNUNET_TIME_Timestamp time;
bool esig;
bool verified;
@@ -3434,7 +3434,9 @@ test_lookup_transfer (
&fee)) ||
(0 != TALER_amount_cmp (&transfer->data.wire_fee,
&fee)) ||
- (transfer->data.execution_time.abs_value_us != time.abs_value_us) ||
+ (GNUNET_TIME_timestamp_cmp (transfer->data.execution_time,
+ !=,
+ time)) ||
(transfer->verified != verified))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -3714,7 +3716,7 @@ lookup_transfer_details_order_cb (
void *cls,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *exchange_url,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const struct TALER_Amount *deposit_value,
const struct TALER_Amount *deposit_fee,
bool transfer_confirmed)
@@ -3731,18 +3733,20 @@ lookup_transfer_details_order_cb (
wtid)) &&
(0 == strcmp (cmp->transfers_to_cmp[i].exchange_url,
exchange_url)) &&
- /*(cmp->transfers_to_cmp[i].execution_time.abs_value_us ==
- execution_time.abs_value_us) &&*/
- (GNUNET_OK == TALER_amount_cmp_currency (
+ (GNUNET_OK ==
+ TALER_amount_cmp_currency (
&cmp->transfers_to_cmp[i].data.total_amount,
deposit_value)) &&
- (0 == TALER_amount_cmp (&cmp->transfers_to_cmp[i].data.total_amount,
- deposit_value)) &&
- (GNUNET_OK == TALER_amount_cmp_currency (
+ (0 ==
+ TALER_amount_cmp (&cmp->transfers_to_cmp[i].data.total_amount,
+ deposit_value)) &&
+ (GNUNET_OK ==
+ TALER_amount_cmp_currency (
&cmp->transfers_to_cmp[i].deposit_fee,
deposit_fee)) &&
- (0 == TALER_amount_cmp (&cmp->transfers_to_cmp[i].deposit_fee,
- deposit_fee)) /* &&
+ (0 ==
+ TALER_amount_cmp (&cmp->transfers_to_cmp[i].deposit_fee,
+ deposit_fee)) /* &&
(cmp->transfers_to_cmp[i].confirmed == transfer_confirmed)*/)
cmp->results_matching[i] += 1;
}
@@ -3847,13 +3851,13 @@ test_lookup_wire_fee (const struct ExchangeSignkeyData *signkey,
{
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 TALER_MasterSignatureP master_sig;
if (1 != plugin->lookup_wire_fee (plugin->cls,
&signkey->master_pub,
wire_fee_data->wire_method,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
&wire_fee,
&closing_fee,
&start_date,
@@ -3864,16 +3868,22 @@ test_lookup_wire_fee (const struct ExchangeSignkeyData *signkey,
"Lookup wire fee failed\n");
return 1;
}
- if ((GNUNET_OK != TALER_amount_cmp_currency (&wire_fee_data->wire_fee,
- &wire_fee)) ||
+ if ((GNUNET_OK !=
+ TALER_amount_cmp_currency (&wire_fee_data->wire_fee,
+ &wire_fee)) ||
(0 != TALER_amount_cmp (&wire_fee_data->wire_fee,
&wire_fee)) ||
- (GNUNET_OK != TALER_amount_cmp_currency (&wire_fee_data->closing_fee,
- &closing_fee)) ||
+ (GNUNET_OK !=
+ TALER_amount_cmp_currency (&wire_fee_data->closing_fee,
+ &closing_fee)) ||
(0 != TALER_amount_cmp (&wire_fee_data->closing_fee,
&closing_fee)) ||
- (wire_fee_data->wire_fee_start.abs_value_us != start_date.abs_value_us) ||
- (wire_fee_data->wire_fee_end.abs_value_us != end_date.abs_value_us) ||
+ (GNUNET_TIME_timestamp_cmp (wire_fee_data->wire_fee_start,
+ !=,
+ start_date)) ||
+ (GNUNET_TIME_timestamp_cmp (wire_fee_data->wire_fee_end,
+ !=,
+ end_date)) ||
(0 != GNUNET_memcmp (&wire_fee_data->fee_sig,
&master_sig)))
{
@@ -3921,7 +3931,7 @@ struct TestLookupTransfers_Closure
* @param payto_uri target account that received the wire transfer
* @param exchange_url base URL of the exchange that made the wire transfer
* @param transfer_serial_id serial number identifying the transfer in the backend
- * @param execution_time when did the exchange make the transfer, #GNUNET_TIME_UNIT_FOREVER_ABS
+ * @param execution_time when did the exchange make the transfer, #GNUNET_TIME_UNIT_FOREVER_TS
* if it did not yet happen
* @param verified true if we checked the exchange's answer and liked it,
* false there is a problem (verification failed or did not yet happen)
@@ -3935,7 +3945,7 @@ lookup_transfers_cb (void *cls,
const char *payto_uri,
const char *exchange_url,
uint64_t transfer_serial_id,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
bool verified,
bool confirmed)
{
@@ -3950,8 +3960,10 @@ lookup_transfers_cb (void *cls,
credit_amount)) &&
(0 == TALER_amount_cmp (&cmp->transfers_to_cmp[i].data.total_amount,
credit_amount)) &&
- (cmp->transfers_to_cmp[i].data.execution_time.abs_value_us ==
- execution_time.abs_value_us))
+ (GNUNET_TIME_timestamp_cmp (
+ cmp->transfers_to_cmp[i].data.execution_time,
+ ==,
+ execution_time)))
{
cmp->results_matching[i] += 1;
}
@@ -3977,8 +3989,8 @@ lookup_transfers_cb (void *cls,
static int
test_lookup_transfers (const struct InstanceData *instance,
const struct TALER_MERCHANTDB_AccountDetails *account,
- struct GNUNET_TIME_Absolute before,
- struct GNUNET_TIME_Absolute after,
+ struct GNUNET_TIME_Timestamp before,
+ struct GNUNET_TIME_Timestamp after,
int64_t limit,
uint64_t offset,
enum TALER_EXCHANGE_YesNoAll filter_verified,
@@ -4242,7 +4254,7 @@ run_test_transfers (struct TestTransfers_Closure *cls)
plugin->lookup_wire_fee (plugin->cls,
&cls->signkey.master_pub,
cls->wire_fee[0].wire_method,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
NULL,
NULL,
NULL,
@@ -4348,8 +4360,8 @@ run_test_transfers (struct TestTransfers_Closure *cls)
&cls->transfers[0]));
TEST_RET_ON_FAIL (test_lookup_transfers (&cls->instance,
&cls->account,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
+ GNUNET_TIME_UNIT_ZERO_TS,
8,
0,
TALER_EXCHANGE_YNA_ALL,
@@ -4409,7 +4421,7 @@ struct ReserveData
/**
* The expiration date
*/
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
};
@@ -4488,8 +4500,8 @@ struct TestLookupReserve_Closure
*/
static void
lookup_reserve_cb (void *cls,
- struct GNUNET_TIME_Absolute creation_time,
- struct GNUNET_TIME_Absolute expiration_time,
+ struct GNUNET_TIME_Timestamp creation_time,
+ struct GNUNET_TIME_Timestamp expiration_time,
const struct TALER_Amount *merchant_initial_amount,
const struct TALER_Amount *exchange_initial_amount,
const struct TALER_Amount *picked_up_amount,
@@ -4504,9 +4516,11 @@ lookup_reserve_cb (void *cls,
unsigned int tip_cmp_results[tips_length];
if (NULL == cmp)
return;
- if ((cmp->reserve_to_cmp->expiration.abs_value_us !=
- expiration_time.abs_value_us) ||
- (GNUNET_OK != TALER_amount_cmp_currency (
+ if (GNUNET_TIME_timestamp_cmp (cmp->reserve_to_cmp->expiration,
+ !=,
+ expiration_time) ||
+ (GNUNET_OK !=
+ TALER_amount_cmp_currency (
&cmp->reserve_to_cmp->initial_amount,
merchant_initial_amount)) ||
(0 != TALER_amount_cmp (&cmp->reserve_to_cmp->initial_amount,
@@ -4629,8 +4643,8 @@ struct TestLookupReserves_Closure
static void
lookup_reserves_cb (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
- struct GNUNET_TIME_Absolute creation_time,
- struct GNUNET_TIME_Absolute expiration_time,
+ struct GNUNET_TIME_Timestamp creation_time,
+ struct GNUNET_TIME_Timestamp expiration_time,
const struct TALER_Amount *merchant_initial_amount,
const struct TALER_Amount *exchange_initial_amount,
const struct TALER_Amount *pickup_amount,
@@ -4642,11 +4656,14 @@ lookup_reserves_cb (void *cls,
return;
for (unsigned int i = 0; cmp->reserves_to_cmp_length > i; ++i)
{
- if ((0 == GNUNET_memcmp (&cmp->reserves_to_cmp[i].reserve_pub,
- reserve_pub)) &&
- (cmp->reserves_to_cmp[i].expiration.abs_value_us ==
- expiration_time.abs_value_us) &&
- (GNUNET_OK == TALER_amount_cmp_currency (
+ if ((0 ==
+ GNUNET_memcmp (&cmp->reserves_to_cmp[i].reserve_pub,
+ reserve_pub)) &&
+ (GNUNET_TIME_timestamp_cmp (cmp->reserves_to_cmp[i].expiration,
+ ==,
+ expiration_time)) &&
+ (GNUNET_OK ==
+ TALER_amount_cmp_currency (
&cmp->reserves_to_cmp[i].initial_amount,
merchant_initial_amount)) &&
(0 == TALER_amount_cmp (&cmp->reserves_to_cmp[i].initial_amount,
@@ -4680,7 +4697,7 @@ test_lookup_reserves (const struct InstanceData *instance,
memset (results_matching, 0, sizeof (unsigned int) * reserves_length);
if (1 != plugin->lookup_reserves (plugin->cls,
instance->instance.id,
- GNUNET_TIME_absolute_get_zero_ (),
+ GNUNET_TIME_UNIT_ZERO_TS,
TALER_EXCHANGE_YNA_ALL,
TALER_EXCHANGE_YNA_ALL,
&lookup_reserves_cb,
@@ -4812,7 +4829,7 @@ struct TipData
/**
* When the tip expires.
*/
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
};
@@ -4876,7 +4893,7 @@ test_lookup_tip (const struct InstanceData *instance,
{
struct TALER_Amount total_authorized;
struct TALER_Amount total_picked_up;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
char *exchange_url = NULL;
struct TALER_ReservePrivateKeyP reserve_priv;
@@ -4894,15 +4911,19 @@ test_lookup_tip (const struct InstanceData *instance,
GNUNET_free (exchange_url);
return 1;
}
- if ((GNUNET_OK != TALER_amount_cmp_currency (&tip->details.total_amount,
- &total_authorized)) ||
+ if ((GNUNET_OK !=
+ TALER_amount_cmp_currency (&tip->details.total_amount,
+ &total_authorized)) ||
(0 != TALER_amount_cmp (&tip->details.total_amount,
&total_authorized)) ||
- (GNUNET_OK != TALER_amount_cmp_currency (expected_total_picked_up,
- &total_picked_up)) ||
+ (GNUNET_OK !=
+ TALER_amount_cmp_currency (expected_total_picked_up,
+ &total_picked_up)) ||
(0 != TALER_amount_cmp (expected_total_picked_up,
&total_picked_up)) ||
- (tip->expiration.abs_value_us != expiration.abs_value_us) ||
+ (GNUNET_TIME_timestamp_cmp (tip->expiration,
+ !=,
+ expiration)) ||
(0 != strcmp (reserve->exchange_url,
exchange_url)) ||
(0 != GNUNET_memcmp (&reserve->reserve_priv,
@@ -4943,7 +4964,7 @@ test_lookup_tip_details (
struct TALER_Amount total_authorized;
struct TALER_Amount total_picked_up;
char *justification = NULL;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct TALER_ReservePublicKeyP reserve_pub;
unsigned int pickups_length;
struct TALER_MERCHANTDB_PickupDetails *pickups = NULL;
@@ -4973,13 +4994,16 @@ test_lookup_tip_details (
&total_authorized)) ||
(0 != TALER_amount_cmp (&tip->details.total_amount,
&total_authorized)) ||
- (GNUNET_OK != TALER_amount_cmp_currency (expected_total_picked_up,
- &total_picked_up)) ||
+ (GNUNET_OK !=
+ TALER_amount_cmp_currency (expected_total_picked_up,
+ &total_picked_up)) ||
(0 != TALER_amount_cmp (expected_total_picked_up,
&total_picked_up)) ||
(0 != strcmp (tip->details.reason,
justification)) ||
- (tip->expiration.abs_value_us != expiration.abs_value_us) ||
+ (GNUNET_TIME_timestamp_cmp (tip->expiration,
+ !=,
+ expiration)) ||
(0 != GNUNET_memcmp (&reserve->reserve_pub,
&reserve_pub)) ||
(expected_pickups_length != pickups_length) )
@@ -5341,9 +5365,8 @@ pre_test_tips (struct TestTips_Closure *cls)
&cls->reserve.initial_amount));
cls->reserve.exchange_url = "exch-url";
cls->reserve.payto_uri = "payto://other-uri";
- cls->reserve.expiration =
- GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- GNUNET_TIME_UNIT_WEEKS);
+ cls->reserve.expiration = GNUNET_TIME_relative_to_timestamp (
+ GNUNET_TIME_UNIT_WEEKS);
GNUNET_CRYPTO_eddsa_key_create (
&cls->expired_reserve.reserve_priv.eddsa_priv);
@@ -5356,7 +5379,7 @@ pre_test_tips (struct TestTips_Closure *cls)
&cls->expired_reserve.initial_amount));
cls->expired_reserve.exchange_url = "exch-url";
cls->expired_reserve.payto_uri = "payto://some-uri";
- cls->expired_reserve.expiration = GNUNET_TIME_UNIT_ZERO_ABS;
+ cls->expired_reserve.expiration = GNUNET_TIME_UNIT_ZERO_TS;
/* Tip/pickup */
make_tip (&cls->tip);
@@ -5753,7 +5776,7 @@ struct RefundData
/**
* When the refund occurred.
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Reason for the refund.
@@ -5786,7 +5809,7 @@ static void
make_refund (const struct DepositData *deposit,
struct RefundData *refund)
{
- refund->timestamp = GNUNET_TIME_absolute_get ();
+ refund->timestamp = GNUNET_TIME_timestamp_get ();
refund->reason = "some reason";
refund->refund_amount = deposit->amount_with_fee;
refund->coin_pub = &deposit->coin_pub;
@@ -5860,7 +5883,7 @@ struct TestLookupRefundsDetailed_Closure
static void
lookup_refunds_detailed_cb (void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
@@ -5874,8 +5897,9 @@ lookup_refunds_detailed_cb (void *cls,
cmp->results_length += 1;
for (unsigned int i = 0; cmp->refunds_to_cmp_length > i; ++i)
{
- if (((cmp->refunds_to_cmp[i].timestamp.abs_value_us ==
- timestamp.abs_value_us) ||
+ if (((GNUNET_TIME_timestamp_cmp (cmp->refunds_to_cmp[i].timestamp,
+ ==,
+ timestamp)) ||
! cmp->cmp_timestamps) &&
(0 == GNUNET_memcmp (cmp->refunds_to_cmp[i].coin_pub,
coin_pub)) &&
@@ -5883,7 +5907,8 @@ lookup_refunds_detailed_cb (void *cls,
exchange_url)) &&
(0 == strcmp (cmp->refunds_to_cmp[i].reason,
reason)) &&
- (GNUNET_OK == TALER_amount_cmp_currency (
+ (GNUNET_OK ==
+ TALER_amount_cmp_currency (
&cmp->refunds_to_cmp[i].refund_amount,
refund_amount)) &&
(0 == TALER_amount_cmp (&cmp->refunds_to_cmp[i].refund_amount,
@@ -5983,7 +6008,7 @@ struct LookupRefundSerial_Closure
static void
get_refund_serial_cb (void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
@@ -5994,15 +6019,17 @@ get_refund_serial_cb (void *cls,
struct LookupRefundSerial_Closure *lookup_cls = cls;
if (NULL == lookup_cls)
return;
- if ((lookup_cls->refund->timestamp.abs_value_us ==
- timestamp.abs_value_us) &&
+ if ((GNUNET_TIME_timestamp_cmp (lookup_cls->refund->timestamp,
+ ==,
+ timestamp)) &&
(0 == GNUNET_memcmp (lookup_cls->refund->coin_pub,
coin_pub)) &&
(0 == strcmp (lookup_cls->refund->exchange_url,
exchange_url)) &&
(0 == strcmp (lookup_cls->refund->reason,
reason)) &&
- (GNUNET_OK == TALER_amount_cmp_currency (
+ (GNUNET_OK ==
+ TALER_amount_cmp_currency (
&lookup_cls->refund->refund_amount,
refund_amount)) &&
(0 == TALER_amount_cmp (&lookup_cls->refund->refund_amount,
@@ -6592,7 +6619,7 @@ run_test_lookup_orders_all_filters (
.paid = (i % 3) + 1,
.refunded = ((i / 3) % 3) + 1,
.wired = ((i / 9) % 3) + 1,
- .date = GNUNET_TIME_absolute_get_zero_ (),
+ .date = GNUNET_TIME_UNIT_ZERO_TS,
.start_row = 0,
.delta = 64
};
@@ -6627,7 +6654,7 @@ run_test_lookup_orders_all_filters (
/* Now test decreasing */
filter.start_row = 256;
- filter.date = GNUNET_TIME_UNIT_FOREVER_ABS;
+ filter.date = GNUNET_TIME_UNIT_FOREVER_TS;
filter.delta = -64;
reverse_order_data_array (orders_length,
@@ -6670,7 +6697,7 @@ kyc_status_ok (void *cls,
uint64_t exchange_kyc_serial,
const char *payto_uri,
const char *exchange_url,
- struct GNUNET_TIME_Absolute last_check,
+ struct GNUNET_TIME_Timestamp last_check,
bool kyc_ok)
{
bool *fail = cls;
@@ -6686,7 +6713,7 @@ kyc_status_fail (void *cls,
uint64_t exchange_kyc_serial,
const char *payto_uri,
const char *exchange_url,
- struct GNUNET_TIME_Absolute last_check,
+ struct GNUNET_TIME_Timestamp last_check,
bool kyc_ok)
{
bool *fail = cls;
@@ -6707,7 +6734,7 @@ test_kyc (void)
struct InstanceData instance;
struct TALER_MERCHANTDB_AccountDetails account;
bool fail;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
make_instance ("test_kyc",
&instance);
@@ -6717,8 +6744,7 @@ test_kyc (void)
TEST_RET_ON_FAIL (test_insert_account (&instance,
&account,
GNUNET_DB_STATUS_SUCCESS_ONE_RESULT));
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
TEST_RET_ON_FAIL (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->account_kyc_set_status (plugin->cls,
instance.instance.id,
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 58148896..7520b553 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -997,7 +997,7 @@ typedef void
uint64_t total_sold,
uint64_t total_lost,
const json_t *location,
- struct GNUNET_TIME_Absolute next_restock);
+ struct GNUNET_TIME_Timestamp next_restock);
/**
@@ -1085,7 +1085,7 @@ TALER_MERCHANT_products_post (
const json_t *taxes,
int64_t total_stock,
const json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
TALER_MERCHANT_ProductsPostCallback cb,
void *cb_cls);
@@ -1161,7 +1161,7 @@ TALER_MERCHANT_product_patch (
int64_t total_stock,
uint64_t total_lost,
const json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
TALER_MERCHANT_ProductPatchCallback cb,
void *cb_cls);
@@ -1353,7 +1353,7 @@ struct TALER_MERCHANT_PostOrdersReply
* When does the backend expect the stock to be
* restocked? 0 for unknown.
*/
- struct GNUNET_TIME_Absolute restock_expected;
+ struct GNUNET_TIME_Timestamp restock_expected;
} gone;
@@ -1480,7 +1480,7 @@ struct TALER_MERCHANT_OrderEntry
* Time when the order was created. Useful for filtering by
* 'date' (in #TALER_MERCHANT_orders_get2()).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Serial ID of the order. Useful for filtering by 'start_row'
@@ -1569,7 +1569,7 @@ TALER_MERCHANT_orders_get2 (
enum TALER_EXCHANGE_YesNoAll paid,
enum TALER_EXCHANGE_YesNoAll refunded,
enum TALER_EXCHANGE_YesNoAll wired,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
uint64_t start_row,
int64_t delta,
struct GNUNET_TIME_Relative timeout,
@@ -1695,7 +1695,7 @@ struct TALER_MERCHANT_WireTransfer
* as the time at which the exchange initiated the transfer
* may differ from the time the bank or the merchant observed).
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Wire transfer subject.
@@ -1761,7 +1761,7 @@ struct TALER_MERCHANT_RefundOrderDetail
/**
* Time when the refund was granted.
*/
- struct GNUNET_TIME_Absolute refund_time;
+ struct GNUNET_TIME_Timestamp refund_time;
/**
* Total amount that was refunded.
@@ -1935,7 +1935,7 @@ struct TALER_MERCHANT_OrderStatusResponse
/**
* Time when the order was created.
*/
- struct GNUNET_TIME_Absolute creation_time;
+ struct GNUNET_TIME_Timestamp creation_time;
/**
* Total amount the order is about (amount to be paid by customer).
@@ -2291,9 +2291,9 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
const struct TALER_Amount *max_fee,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantSignatureP *merchant_sig,
- struct GNUNET_TIME_Absolute timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const struct TALER_MerchantWireHash *h_wire,
const char *order_id,
unsigned int num_coins,
@@ -2736,7 +2736,7 @@ typedef void
(*TALER_MERCHANT_PostTransfersCallback) (
void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const struct TALER_Amount *total_amount,
const struct TALER_Amount *wire_fee,
unsigned int details_length,
@@ -2876,7 +2876,7 @@ struct TALER_MERCHANT_TransferData
* Time of the wire transfer, according to the exchange.
* 0 for not provided by the exchange.
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Did we check the exchange's answer and are happy about it? False if we
@@ -2941,8 +2941,8 @@ TALER_MERCHANT_transfers_get (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const char *payto_uri,
- const struct GNUNET_TIME_Absolute before,
- const struct GNUNET_TIME_Absolute after,
+ const struct GNUNET_TIME_Timestamp before,
+ const struct GNUNET_TIME_Timestamp after,
int64_t limit,
uint64_t offset,
enum TALER_EXCHANGE_YesNoAll verified,
@@ -3040,12 +3040,12 @@ struct TALER_MERCHANT_ReserveSummary
/**
* Timestamp when it was established
*/
- struct GNUNET_TIME_Absolute creation_time;
+ struct GNUNET_TIME_Timestamp creation_time;
/**
* Timestamp when it expires
*/
- struct GNUNET_TIME_Absolute expiration_time;
+ struct GNUNET_TIME_Timestamp expiration_time;
/**
* Initial amount as per reserve creation call
@@ -3108,7 +3108,7 @@ typedef void
struct TALER_MERCHANT_ReservesGetHandle *
TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- struct GNUNET_TIME_Absolute after,
+ struct GNUNET_TIME_Timestamp after,
enum TALER_EXCHANGE_YesNoAll active,
enum TALER_EXCHANGE_YesNoAll failures,
TALER_MERCHANT_ReservesGetCallback cb,
@@ -3232,7 +3232,7 @@ typedef void
const struct TALER_MERCHANT_HttpResponse *hr,
struct GNUNET_HashCode *tip_id,
const char *tip_uri,
- struct GNUNET_TIME_Absolute tip_expiration);
+ struct GNUNET_TIME_Timestamp tip_expiration);
/**
@@ -3384,7 +3384,7 @@ typedef void
(*TALER_MERCHANT_TipWalletGetCallback) (
void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
- struct GNUNET_TIME_Absolute expiration,
+ struct GNUNET_TIME_Timestamp expiration,
const char *exchange_url,
const struct TALER_Amount *amount_remaining);
@@ -3465,7 +3465,7 @@ typedef void
const struct TALER_Amount *total_authorized,
const struct TALER_Amount *total_picked_up,
const char *reason,
- struct GNUNET_TIME_Absolute expiration,
+ struct GNUNET_TIME_Timestamp expiration,
const struct TALER_ReservePublicKeyP *reserve_pub,
unsigned int pickups_length,
const struct TALER_MERCHANT_PickupDetail pickups[]);
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index de49336f..18a1e0cc 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -339,7 +339,7 @@ TALER_TESTING_cmd_merchant_post_products2 (
json_t *taxes,
int64_t total_stock,
json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
unsigned int http_status);
@@ -404,7 +404,7 @@ TALER_TESTING_cmd_merchant_patch_product (
int64_t total_stock,
uint64_t total_lost,
json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
unsigned int http_status);
@@ -502,15 +502,14 @@ TALER_TESTING_cmd_merchant_delete_product (const char *label,
* @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_orders (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *order_id,
- struct GNUNET_TIME_Absolute
- refund_deadline,
- struct GNUNET_TIME_Absolute
- pay_deadline,
- const char *amount);
+TALER_TESTING_cmd_merchant_post_orders (
+ const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *order_id,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
+ const char *amount);
/**
* Make the "proposal" command AVOIDING claiming the order.
@@ -526,15 +525,14 @@ TALER_TESTING_cmd_merchant_post_orders (const char *label,
* @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_orders_no_claim (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *order_id,
- struct GNUNET_TIME_Absolute
- refund_deadline,
- struct GNUNET_TIME_Absolute
- pay_deadline,
- const char *amount);
+TALER_TESTING_cmd_merchant_post_orders_no_claim (
+ const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *order_id,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
+ const char *amount);
/**
* Make the "proposal" command.
@@ -564,8 +562,8 @@ TALER_TESTING_cmd_merchant_post_orders2 (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
bool claim_token,
const char *amount,
const char *payment_target,
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 19e59812..3925011a 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -233,7 +233,7 @@ struct TALER_MERCHANTDB_ProductDetails
* Identifies when the product will be restocked. 0 for unknown,
* #GNUNET_TIME_UNIT_FOREVER_ABS for never.
*/
- struct GNUNET_TIME_Absolute next_restock;
+ struct GNUNET_TIME_Timestamp next_restock;
};
@@ -260,7 +260,7 @@ struct TALER_MERCHANTDB_OrderFilter
/**
* Filter orders by date, exact meaning depends on @e delta.
*/
- struct GNUNET_TIME_Absolute date;
+ struct GNUNET_TIME_Timestamp date;
/**
* Filter orders by order serial number, exact meaning depends on @e delta.
@@ -293,7 +293,7 @@ typedef void
(*TALER_MERCHANTDB_OrdersCallback)(void *cls,
const char *order_id,
uint64_t order_serial,
- struct GNUNET_TIME_Absolute timestamp);
+ struct GNUNET_TIME_Timestamp timestamp);
/**
@@ -349,7 +349,7 @@ typedef void
void *cls,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *exchange_url,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const struct TALER_Amount *deposit_value,
const struct TALER_Amount *deposit_fee,
bool transfer_confirmed);
@@ -372,7 +372,7 @@ typedef void
(*TALER_MERCHANTDB_RefundDetailCallback)(
void *cls,
uint64_t refund_serial,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
uint64_t rtransaction_id,
@@ -400,7 +400,7 @@ typedef void
uint64_t exchange_kyc_serial,
const char *payto_uri,
const char *exchange_url,
- struct GNUNET_TIME_Absolute last_check,
+ struct GNUNET_TIME_Timestamp last_check,
bool kyc_ok);
@@ -493,7 +493,7 @@ typedef void
const char *payto_uri,
const char *exchange_url,
uint64_t transfer_serial_id,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
bool verified,
bool confirmed);
@@ -517,8 +517,8 @@ typedef void
(*TALER_MERCHANTDB_ReservesCallback)(
void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
- struct GNUNET_TIME_Absolute creation_time,
- struct GNUNET_TIME_Absolute expiration_time,
+ struct GNUNET_TIME_Timestamp creation_time,
+ struct GNUNET_TIME_Timestamp expiration_time,
const struct TALER_Amount *merchant_initial_amount,
const struct TALER_Amount *exchange_initial_amount,
const struct TALER_Amount *pickup_amount,
@@ -609,8 +609,8 @@ typedef void
typedef void
(*TALER_MERCHANTDB_ReserveDetailsCallback)(
void *cls,
- struct GNUNET_TIME_Absolute creation_time,
- struct GNUNET_TIME_Absolute expiration_time,
+ struct GNUNET_TIME_Timestamp creation_time,
+ struct GNUNET_TIME_Timestamp expiration_time,
const struct TALER_Amount *merchant_initial_amount,
const struct TALER_Amount *exchange_initial_amount,
const struct TALER_Amount *picked_up_amount,
@@ -661,8 +661,8 @@ typedef void
const struct TALER_Amount *refund_fee,
const struct TALER_Amount *wire_fee,
const struct TALER_MerchantWireHash *h_wire,
- struct GNUNET_TIME_Absolute deposit_timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Timestamp deposit_timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_ExchangePublicKeyP *exchange_pub);
@@ -1027,7 +1027,7 @@ struct TALER_MERCHANTDB_Plugin
uint64_t exchange_kyc_serial,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
bool kyc_ok);
@@ -1136,7 +1136,7 @@ struct TALER_MERCHANTDB_Plugin
const char *product_id,
const struct GNUNET_Uuid *uuid,
uint64_t quantity,
- struct GNUNET_TIME_Absolute expiration_time);
+ struct GNUNET_TIME_Timestamp expiration_time);
/**
@@ -1202,7 +1202,7 @@ struct TALER_MERCHANTDB_Plugin
(*lookup_order_summary)(void *cls,
const char *instance_id,
const char *order_id,
- struct GNUNET_TIME_Absolute *timestamp,
+ struct GNUNET_TIME_Timestamp *timestamp,
uint64_t *order_serial);
@@ -1241,7 +1241,7 @@ struct TALER_MERCHANTDB_Plugin
const char *instance_id,
const char *order_id,
const struct GNUNET_HashCode *h_post_data,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const struct TALER_ClaimTokenP *claim_token,
const json_t *contract_terms);
@@ -1400,9 +1400,9 @@ struct TALER_MERCHANTDB_Plugin
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute expire_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp expire_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterSignatureP *master_sig);
@@ -1426,7 +1426,7 @@ struct TALER_MERCHANTDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_deposit)(void *cls,
const char *instance_id,
- struct GNUNET_TIME_Absolute deposit_timestamp,
+ struct GNUNET_TIME_Timestamp deposit_timestamp,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *exchange_url,
@@ -1495,7 +1495,7 @@ struct TALER_MERCHANTDB_Plugin
(*refund_coin)(void *cls,
const char *instance_id,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute refund_timestamp,
+ struct GNUNET_TIME_Timestamp refund_timestamp,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const char *reason);
@@ -1828,11 +1828,11 @@ struct TALER_MERCHANTDB_Plugin
(*lookup_wire_fee)(void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const char *wire_method,
- struct GNUNET_TIME_Absolute contract_date,
+ struct GNUNET_TIME_Timestamp contract_date,
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 TALER_MasterSignatureP *master_sig);
@@ -1885,7 +1885,7 @@ struct TALER_MERCHANTDB_Plugin
struct TALER_Amount *total_amount,
struct TALER_Amount *wire_fee,
struct TALER_Amount *exchange_amount,
- struct GNUNET_TIME_Absolute *execution_time,
+ struct GNUNET_TIME_Timestamp *execution_time,
bool *have_exchange_sig,
bool *verified);
@@ -1969,8 +1969,8 @@ struct TALER_MERCHANTDB_Plugin
(*lookup_transfers)(void *cls,
const char *instance_id,
const char *payto_uri,
- struct GNUNET_TIME_Absolute before,
- struct GNUNET_TIME_Absolute after,
+ struct GNUNET_TIME_Timestamp before,
+ struct GNUNET_TIME_Timestamp after,
int64_t limit,
uint64_t offset,
enum TALER_EXCHANGE_YesNoAll yna,
@@ -2000,8 +2000,8 @@ struct TALER_MERCHANTDB_Plugin
const struct GNUNET_HashCode *h_wire_method,
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 *exchange_sig);
@@ -2031,7 +2031,7 @@ struct TALER_MERCHANTDB_Plugin
const char *exchange_url,
const char *payto_uri,
const struct TALER_Amount *initial_balance,
- struct GNUNET_TIME_Absolute expiration);
+ struct GNUNET_TIME_Timestamp expiration);
/**
@@ -2069,7 +2069,7 @@ struct TALER_MERCHANTDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_reserves)(void *cls,
const char *instance_id,
- struct GNUNET_TIME_Absolute created_after,
+ struct GNUNET_TIME_Timestamp created_after,
enum TALER_EXCHANGE_YesNoAll active,
enum TALER_EXCHANGE_YesNoAll failures,
TALER_MERCHANTDB_ReservesCallback cb,
@@ -2169,7 +2169,7 @@ struct TALER_MERCHANTDB_Plugin
const char *justification,
const char *next_url,
struct GNUNET_HashCode *tip_id,
- struct GNUNET_TIME_Absolute *expiration);
+ struct GNUNET_TIME_Timestamp *expiration);
/**
@@ -2216,7 +2216,7 @@ struct TALER_MERCHANTDB_Plugin
const struct GNUNET_HashCode *tip_id,
struct TALER_Amount *total_authorized,
struct TALER_Amount *total_picked_up,
- struct GNUNET_TIME_Absolute *expiration,
+ struct GNUNET_TIME_Timestamp *expiration,
char **exchange_url,
struct TALER_ReservePrivateKeyP *reserve_priv);
@@ -2268,7 +2268,7 @@ struct TALER_MERCHANTDB_Plugin
struct TALER_Amount *total_authorized,
struct TALER_Amount *total_picked_up,
char **justification,
- struct GNUNET_TIME_Absolute *expiration,
+ struct GNUNET_TIME_Timestamp *expiration,
struct TALER_ReservePublicKeyP *reserve_pub,
unsigned int *pickups_length,
struct TALER_MERCHANTDB_PickupDetails **pickups);
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 7a0fa94f..95e431e5 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -10,7 +10,7 @@ lib_LTLIBRARIES = \
libtalermerchant.la
libtalermerchant_la_LDFLAGS = \
- -version-info 2:0:0 \
+ -version-info 3:0:0 \
-no-undefined
libtalermerchant_la_SOURCES = \
diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c
index edf45e97..bb71a1ed 100644
--- a/src/lib/merchant_api_get_instance.c
+++ b/src/lib/merchant_api_get_instance.c
@@ -119,10 +119,10 @@ handle_get_instance_finished (void *cls,
&default_wire_fee_amortization),
TALER_JSON_spec_amount_any ("default_max_deposit_fee",
&default_max_deposit_fee),
- TALER_JSON_spec_relative_time ("default_wire_transfer_delay",
- &default_wire_transfer_delay),
- TALER_JSON_spec_relative_time ("default_pay_delay",
- &default_pay_delay),
+ GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay",
+ &default_wire_transfer_delay),
+ GNUNET_JSON_spec_relative_time ("default_pay_delay",
+ &default_pay_delay),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/merchant_api_get_orders.c b/src/lib/merchant_api_get_orders.c
index 92a20614..817c9240 100644
--- a/src/lib/merchant_api_get_orders.c
+++ b/src/lib/merchant_api_get_orders.c
@@ -87,8 +87,8 @@ parse_orders (const json_t *ia,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("order_id",
&ie->order_id),
- TALER_JSON_spec_absolute_time ("timestamp",
- &ie->timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &ie->timestamp),
GNUNET_JSON_spec_uint64 ("row_id",
&ie->order_serial),
TALER_JSON_spec_amount_any ("amount",
@@ -232,7 +232,7 @@ TALER_MERCHANT_orders_get (
TALER_EXCHANGE_YNA_ALL,
TALER_EXCHANGE_YNA_ALL,
TALER_EXCHANGE_YNA_ALL,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
UINT64_MAX,
-20, /* default is most recent 20 entries */
GNUNET_TIME_UNIT_ZERO,
@@ -248,7 +248,7 @@ TALER_MERCHANT_orders_get2 (
enum TALER_EXCHANGE_YesNoAll paid,
enum TALER_EXCHANGE_YesNoAll refunded,
enum TALER_EXCHANGE_YesNoAll wired,
- struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Timestamp date,
uint64_t start_row,
int64_t delta,
struct GNUNET_TIME_Relative timeout,
@@ -292,21 +292,21 @@ TALER_MERCHANT_orders_get2 (
sizeof (cbuf),
"%llu",
(unsigned long long) start_row);
+ // FIXME: use date_s, no need for milliseconds!
GNUNET_snprintf (dstr,
sizeof (dstr),
"%llu",
- (unsigned long long) (date.abs_value_us
+ (unsigned long long) (date.abs_time.abs_value_us
/ GNUNET_TIME_UNIT_MILLISECONDS.
rel_value_us));
if (delta > 0)
{
- have_date = (0 != date.abs_value_us);
+ have_date = ! GNUNET_TIME_absolute_is_zero (date.abs_time);
have_srow = (0 != start_row);
}
else
{
- have_date = (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- date.abs_value_us);
+ have_date = ! GNUNET_TIME_absolute_is_never (date.abs_time);
have_srow = (UINT64_MAX != start_row);
}
ogh->url = TALER_url_join (backend_url,
diff --git a/src/lib/merchant_api_get_product.c b/src/lib/merchant_api_get_product.c
index 73fa9f71..94d38ec7 100644
--- a/src/lib/merchant_api_get_product.c
+++ b/src/lib/merchant_api_get_product.c
@@ -103,7 +103,8 @@ handle_get_product_finished (void *cls,
uint64_t total_lost;
json_t *address;
bool rst_ok = true;
- struct GNUNET_TIME_Absolute next_restock = {0};
+ struct GNUNET_TIME_Timestamp next_restock
+ = GNUNET_TIME_UNIT_ZERO_TS;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("description",
&description),
@@ -133,8 +134,8 @@ handle_get_product_finished (void *cls,
"next_restock"))
{
struct GNUNET_JSON_Specification spect[] = {
- TALER_JSON_spec_absolute_time ("next_restock",
- &next_restock),
+ GNUNET_JSON_spec_timestamp ("next_restock",
+ &next_restock),
GNUNET_JSON_spec_end ()
};
@@ -205,7 +206,7 @@ handle_get_product_finished (void *cls,
0,
0,
NULL,
- GNUNET_TIME_UNIT_FOREVER_ABS);
+ GNUNET_TIME_UNIT_FOREVER_TS);
TALER_MERCHANT_product_get_cancel (pgh);
}
diff --git a/src/lib/merchant_api_get_reserve.c b/src/lib/merchant_api_get_reserve.c
index f7ce1927..3d8f9cbf 100644
--- a/src/lib/merchant_api_get_reserve.c
+++ b/src/lib/merchant_api_get_reserve.c
@@ -99,9 +99,9 @@ handle_reserve_get_finished (void *cls,
const char *exchange_url = NULL;
const char *payto_uri = NULL;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("creation_time",
+ GNUNET_JSON_spec_timestamp ("creation_time",
&rs.creation_time),
- TALER_JSON_spec_absolute_time ("expiration_time",
+ GNUNET_JSON_spec_timestamp ("expiration_time",
&rs.expiration_time),
GNUNET_JSON_spec_bool ("active",
&active),
diff --git a/src/lib/merchant_api_get_reserves.c b/src/lib/merchant_api_get_reserves.c
index 56bcd133..24a527d6 100644
--- a/src/lib/merchant_api_get_reserves.c
+++ b/src/lib/merchant_api_get_reserves.c
@@ -135,10 +135,10 @@ handle_reserves_get_finished (void *cls,
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("reserve_pub",
&rd->reserve_pub),
- TALER_JSON_spec_absolute_time ("creation_time",
- &rd->creation_time),
- TALER_JSON_spec_absolute_time ("expiration_time",
- &rd->expiration_time),
+ GNUNET_JSON_spec_timestamp ("creation_time",
+ &rd->creation_time),
+ GNUNET_JSON_spec_timestamp ("expiration_time",
+ &rd->expiration_time),
TALER_JSON_spec_amount_any ("merchant_initial_amount",
&rd->merchant_initial_amount),
TALER_JSON_spec_amount_any ("exchange_initial_amount",
@@ -217,7 +217,7 @@ handle_reserves_get_finished (void *cls,
struct TALER_MERCHANT_ReservesGetHandle *
TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- struct GNUNET_TIME_Absolute after,
+ struct GNUNET_TIME_Timestamp after,
enum TALER_EXCHANGE_YesNoAll active,
enum TALER_EXCHANGE_YesNoAll failures,
TALER_MERCHANT_ReservesGetCallback cb,
@@ -235,8 +235,8 @@ TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx,
rgh->cb_cls = cb_cls;
active_s = TALER_yna_to_string (active);
failures_s = TALER_yna_to_string (failures);
- after_s = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (
- after));
+ // FIXME: use different format?
+ after_s = GNUNET_strdup (GNUNET_TIME_timestamp2s (after));
rgh->url = TALER_url_join (backend_url,
"private/reserves",
"active",
@@ -244,9 +244,9 @@ TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx,
"failures",
failures_s,
"after",
- after.abs_value_us != 0
- ? after_s
- : NULL,
+ GNUNET_TIME_absolute_is_zero (after.abs_time)
+ ? NULL
+ : after_s,
NULL);
GNUNET_free (after_s);
if (NULL == rgh->url)
diff --git a/src/lib/merchant_api_get_transfers.c b/src/lib/merchant_api_get_transfers.c
index 13a05998..0d061498 100644
--- a/src/lib/merchant_api_get_transfers.c
+++ b/src/lib/merchant_api_get_transfers.c
@@ -144,8 +144,8 @@ handle_transfers_get_finished (void *cls,
GNUNET_JSON_spec_uint64 ("transfer_serial_id",
&td->credit_serial),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("execution_time",
- &td->execution_time)),
+ GNUNET_JSON_spec_timestamp ("execution_time",
+ &td->execution_time)),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("verified",
&td->verified)),
@@ -228,8 +228,8 @@ TALER_MERCHANT_transfers_get (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const char *payto_uri,
- const struct GNUNET_TIME_Absolute before,
- const struct GNUNET_TIME_Absolute after,
+ const struct GNUNET_TIME_Timestamp before,
+ const struct GNUNET_TIME_Timestamp after,
int64_t limit,
uint64_t offset,
enum TALER_EXCHANGE_YesNoAll verified,
@@ -257,8 +257,9 @@ TALER_MERCHANT_transfers_get (
sizeof (offset_s),
"%lld",
(unsigned long long) offset);
- before_s = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (before));
- after_s = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (after));
+ // FIXME: use other format?
+ before_s = GNUNET_strdup (GNUNET_TIME_timestamp2s (before));
+ after_s = GNUNET_strdup (GNUNET_TIME_timestamp2s (after));
gth->url = TALER_url_join (backend_url,
"private/transfers",
"payto_uri",
@@ -276,14 +277,13 @@ TALER_MERCHANT_transfers_get (
? offset_s
: NULL,
"before",
- before.abs_value_us !=
- GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us
- ? before_s
- : NULL,
+ GNUNET_TIME_absolute_is_never (before.abs_time)
+ ? NULL
+ : before_s,
"after",
- after.abs_value_us != 0
- ? after_s
- : NULL,
+ GNUNET_TIME_absolute_is_zero (after.abs_time)
+ ? NULL
+ : after_s,
NULL);
GNUNET_free (before_s);
GNUNET_free (after_s);
diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c
index 643c8a51..aedeb366 100644
--- a/src/lib/merchant_api_merchant_get_order.c
+++ b/src/lib/merchant_api_merchant_get_order.c
@@ -91,7 +91,7 @@ handle_unpaid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
&osr.details.unpaid.taler_pay_uri),
GNUNET_JSON_spec_string ("summary",
&osr.details.unpaid.summary),
- TALER_JSON_spec_absolute_time ("creation_time",
+ GNUNET_JSON_spec_timestamp ("creation_time",
&osr.details.unpaid.creation_time),
GNUNET_JSON_spec_end ()
};
@@ -249,7 +249,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
&wt->exchange_url),
GNUNET_JSON_spec_fixed_auto ("wtid",
&wt->wtid),
- TALER_JSON_spec_absolute_time ("execution_time",
+ GNUNET_JSON_spec_timestamp ("execution_time",
&wt->execution_time),
TALER_JSON_spec_amount_any ("amount",
&wt->total_amount),
@@ -324,7 +324,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
&ro->refund_amount),
GNUNET_JSON_spec_string ("reason",
&ro->reason),
- TALER_JSON_spec_absolute_time ("timestamp",
+ GNUNET_JSON_spec_timestamp ("timestamp",
&ro->refund_time),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/merchant_api_merchant_get_tip.c b/src/lib/merchant_api_merchant_get_tip.c
index 1b4cf082..374634b4 100644
--- a/src/lib/merchant_api_merchant_get_tip.c
+++ b/src/lib/merchant_api_merchant_get_tip.c
@@ -65,7 +65,7 @@ parse_pickups (const json_t *pa,
const struct TALER_Amount *total_authorized,
const struct TALER_Amount *total_picked_up,
const char *reason,
- struct GNUNET_TIME_Absolute expiration,
+ struct GNUNET_TIME_Timestamp expiration,
const struct TALER_ReservePublicKeyP *reserve_pub,
struct TALER_MERCHANT_TipMerchantGetHandle *tgh)
{
@@ -150,7 +150,7 @@ handle_merchant_tip_get_finished (void *cls,
struct TALER_Amount total_authorized;
struct TALER_Amount total_picked_up;
const char *reason;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct TALER_ReservePublicKeyP reserve_pub;
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("total_authorized",
@@ -159,8 +159,8 @@ handle_merchant_tip_get_finished (void *cls,
&total_picked_up),
GNUNET_JSON_spec_string ("reason",
&reason),
- TALER_JSON_spec_absolute_time ("expiration",
- &expiration),
+ GNUNET_JSON_spec_timestamp ("expiration",
+ &expiration),
GNUNET_JSON_spec_fixed_auto ("reserve_pub",
&reserve_pub),
GNUNET_JSON_spec_end ()
@@ -246,7 +246,7 @@ handle_merchant_tip_get_finished (void *cls,
NULL,
NULL,
NULL,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
NULL,
0,
NULL);
diff --git a/src/lib/merchant_api_patch_product.c b/src/lib/merchant_api_patch_product.c
index 200c0a50..7f931655 100644
--- a/src/lib/merchant_api_patch_product.c
+++ b/src/lib/merchant_api_patch_product.c
@@ -169,14 +169,13 @@ TALER_MERCHANT_product_patch (
int64_t total_stock,
uint64_t total_lost,
const json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
TALER_MERCHANT_ProductPatchCallback cb,
void *cb_cls)
{
struct TALER_MERCHANT_ProductPatchHandle *pph;
json_t *req_obj;
- (void) GNUNET_TIME_round_abs (&next_restock);
req_obj = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("description",
description),
@@ -196,8 +195,8 @@ TALER_MERCHANT_product_patch (
total_lost),
GNUNET_JSON_pack_object_incref ("address",
(json_t *) address),
- GNUNET_JSON_pack_time_abs ("next_restock",
- next_restock));
+ GNUNET_JSON_pack_timestamp ("next_restock",
+ next_restock));
pph = GNUNET_new (struct TALER_MERCHANT_ProductPatchHandle);
pph->ctx = ctx;
pph->cb = cb;
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
index 869533c4..bb4e2ca6 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -575,9 +575,9 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
const struct TALER_Amount *max_fee,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantSignatureP *merchant_sig,
- struct GNUNET_TIME_Absolute timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const struct TALER_MerchantWireHash *h_wire,
const char *order_id,
unsigned int num_coins,
@@ -585,9 +585,6 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
TALER_MERCHANT_OrderPayCallback pay_cb,
void *pay_cb_cls)
{
- (void) GNUNET_TIME_round_abs (&timestamp);
- (void) GNUNET_TIME_round_abs (&pay_deadline);
- (void) GNUNET_TIME_round_abs (&refund_deadline);
if (GNUNET_YES !=
TALER_amount_cmp_currency (amount,
max_fee))
diff --git a/src/lib/merchant_api_post_orders.c b/src/lib/merchant_api_post_orders.c
index 430ddcdd..ff142cde 100644
--- a/src/lib/merchant_api_post_orders.c
+++ b/src/lib/merchant_api_post_orders.c
@@ -175,7 +175,7 @@ handle_post_order_finished (void *cls,
"available_quantity",
&por.details.gone.available_quantity),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_absolute_time (
+ GNUNET_JSON_spec_timestamp (
"restock_expected",
&por.details.gone.restock_expected)),
GNUNET_JSON_spec_end ()
diff --git a/src/lib/merchant_api_post_products.c b/src/lib/merchant_api_post_products.c
index b2f44139..43799032 100644
--- a/src/lib/merchant_api_post_products.c
+++ b/src/lib/merchant_api_post_products.c
@@ -170,14 +170,13 @@ TALER_MERCHANT_products_post (
const json_t *taxes,
int64_t total_stock,
const json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
TALER_MERCHANT_ProductsPostCallback cb,
void *cb_cls)
{
struct TALER_MERCHANT_ProductsPostHandle *pph;
json_t *req_obj;
- (void) GNUNET_TIME_round_abs (&next_restock);
req_obj = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("product_id",
product_id),
@@ -198,8 +197,8 @@ TALER_MERCHANT_products_post (
GNUNET_JSON_pack_object_incref ("address",
(json_t *) address),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs ("next_restock",
- next_restock)));
+ GNUNET_JSON_pack_timestamp ("next_restock",
+ next_restock)));
pph = GNUNET_new (struct TALER_MERCHANT_ProductsPostHandle);
pph->ctx = ctx;
pph->cb = cb;
diff --git a/src/lib/merchant_api_post_transfers.c b/src/lib/merchant_api_post_transfers.c
index 8b302ab1..01144833 100644
--- a/src/lib/merchant_api_post_transfers.c
+++ b/src/lib/merchant_api_post_transfers.c
@@ -101,15 +101,15 @@ handle_post_transfers_finished (void *cls,
{
struct TALER_Amount total;
struct TALER_Amount wire_fee;
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
json_t *deposit_sums;
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("total",
&total),
TALER_JSON_spec_amount_any ("wire_fee",
&wire_fee),
- TALER_JSON_spec_absolute_time ("execution_time",
- &execution_time),
+ GNUNET_JSON_spec_timestamp ("execution_time",
+ &execution_time),
GNUNET_JSON_spec_json ("deposit_sums",
&deposit_sums),
GNUNET_JSON_spec_end ()
@@ -263,7 +263,7 @@ handle_post_transfers_finished (void *cls,
}
pth->cb (pth->cb_cls,
&hr,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
NULL,
NULL,
0,
diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_tip_authorize.c
index 1b177ea9..c56fab38 100644
--- a/src/lib/merchant_api_tip_authorize.c
+++ b/src/lib/merchant_api_tip_authorize.c
@@ -87,11 +87,11 @@ check_ok (struct TALER_MERCHANT_TipAuthorizeHandle *tao,
const char *tip_status_url;
const char *taler_tip_uri;
struct GNUNET_HashCode tip_id;
- struct GNUNET_TIME_Absolute expiration_time;
+ struct GNUNET_TIME_Timestamp expiration_time;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("tip_status_url", &tip_status_url),
GNUNET_JSON_spec_string ("taler_tip_uri", &taler_tip_uri),
- TALER_JSON_spec_absolute_time ("tip_expiration", &expiration_time),
+ GNUNET_JSON_spec_timestamp ("tip_expiration", &expiration_time),
GNUNET_JSON_spec_fixed_auto ("tip_id", &tip_id),
GNUNET_JSON_spec_end ()
};
@@ -207,7 +207,7 @@ handle_tip_authorize_finished (void *cls,
&hr,
NULL,
NULL,
- GNUNET_TIME_UNIT_ZERO_ABS);
+ GNUNET_TIME_UNIT_ZERO_TS);
TALER_MERCHANT_tip_authorize_cancel (tao);
}
diff --git a/src/lib/merchant_api_wallet_get_tip.c b/src/lib/merchant_api_wallet_get_tip.c
index f503af85..cd40dc4e 100644
--- a/src/lib/merchant_api_wallet_get_tip.c
+++ b/src/lib/merchant_api_wallet_get_tip.c
@@ -95,10 +95,10 @@ handle_wallet_tip_get_finished (void *cls,
{
const char *exchange_url;
struct TALER_Amount amount_remaining;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("expiration",
- &expiration),
+ GNUNET_JSON_spec_timestamp ("expiration",
+ &expiration),
GNUNET_JSON_spec_string ("exchange_url",
&exchange_url),
TALER_JSON_spec_amount_any ("tip_amount",
@@ -149,7 +149,7 @@ handle_wallet_tip_get_finished (void *cls,
}
tgh->cb (tgh->cb_cls,
&hr,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
NULL,
NULL);
TALER_MERCHANT_wallet_tip_get_cancel (tgh);
diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c
index 60cbe43d..877eaa4b 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -228,8 +228,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
NULL, /* random order ID please */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
CURRENCY_5),
TALER_TESTING_cmd_merchant_pay_order ("deposit-simple",
merchant_url,
@@ -249,8 +249,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
NULL, /* random order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
CURRENCY_5),
TALER_TESTING_cmd_merchant_pay_order ("deposit-simple-2",
merchant_url,
@@ -321,8 +321,8 @@ run (void *cls,
alt_instance_url,
MHD_HTTP_OK,
NULL, /* use random order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
CURRENCY_5),
TALER_TESTING_cmd_merchant_pay_order ("deposit-unaggregated",
alt_instance_url,
@@ -353,8 +353,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
NULL, /* use random order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
CURRENCY_10),
TALER_TESTING_cmd_merchant_pay_order ("deposit-twocoins",
merchant_url,
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 8bb19eab..1ea06022 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -190,8 +190,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1", /* order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true,
"EUR:5.0",
"x-taler-bank",
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index ea68a3eb..9892732d 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -232,8 +232,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"4",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
TALER_TESTING_cmd_merchant_get_order ("get-order-4",
merchant_url,
@@ -304,8 +304,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1", /* order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true,
"EUR:5.0",
"x-taler-bank",
@@ -316,8 +316,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1", /* order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true,
"EUR:5.0",
"x-taler-bank",
@@ -328,8 +328,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1x", /* order ID */
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true,
"EUR:5.0",
"x-taler-bank",
@@ -355,8 +355,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_CONFLICT,
"1",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
TALER_TESTING_cmd_poll_orders_conclude ("poll-orders-1-conclude",
MHD_HTTP_OK,
@@ -584,7 +584,7 @@ run (void *cls,
5,
0,
json_object (),
- GNUNET_TIME_relative_to_absolute (
+ GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_UNIT_MINUTES),
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_lock_product ("lock-product-p3",
@@ -597,8 +597,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_NOT_FOUND,
"order-p3",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true, /* claim token */
"EUR:5.0",
"unsupported-wire-method",
@@ -609,8 +609,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_NOT_FOUND,
"order-p3",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true,
"EUR:5.0",
"x-taler-bank",
@@ -622,8 +622,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_GONE,
"order-p3",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
true,
"EUR:5.0",
"x-taler-bank",
@@ -634,8 +634,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"order-p3",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
false,
"EUR:5.0",
"x-taler-bank",
@@ -650,8 +650,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
NULL,
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-2"),
TALER_TESTING_cmd_end ()
@@ -662,8 +662,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"2",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal-2",
merchant_url,
@@ -717,8 +717,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1r",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-refund-1-low",
merchant_url,
@@ -819,8 +819,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1-unpaid",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
/* Try to increase an unpaid proposal. */
TALER_TESTING_cmd_merchant_order_refund ("refund-increase-unpaid-proposal",
@@ -862,8 +862,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"unincreased-proposal",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:5.0"),
TALER_TESTING_cmd_merchant_pay_order ("pay-unincreased-proposal",
merchant_url,
@@ -1182,8 +1182,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"10",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:10.0"),
TALER_TESTING_cmd_merchant_pay_order ("pay-fail-partial-double-10",
merchant_url,
@@ -1236,8 +1236,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"11",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:10.0"),
TALER_TESTING_cmd_merchant_pay_order ("pay-fail-partial-double-11-good",
merchant_url,
@@ -1540,7 +1540,7 @@ run (void *cls,
json_pack ("{s:s}",
"street",
"pstreet"),
- GNUNET_TIME_relative_to_absolute (
+ GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_UNIT_MINUTES),
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_get_product ("get-product-p2",
@@ -1567,7 +1567,7 @@ run (void *cls,
json_pack ("{s:s}",
"street",
"pstreet"),
- GNUNET_TIME_relative_to_absolute (
+ GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_UNIT_MINUTES),
MHD_HTTP_NOT_FOUND),
TALER_TESTING_cmd_merchant_delete_product ("get-products-empty",
diff --git a/src/testing/test_merchant_api_twisted.c b/src/testing/test_merchant_api_twisted.c
index c6b53049..ddea21a2 100644
--- a/src/testing/test_merchant_api_twisted.c
+++ b/src/testing/test_merchant_api_twisted.c
@@ -223,8 +223,8 @@ run (void *cls,
twister_merchant_url,
MHD_HTTP_OK,
"abort-one",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:3.0"),
/* Will only pay _half_ the supposed price,
* so we'll then have the right to abort. */
@@ -280,15 +280,15 @@ run (void *cls,
twister_merchant_url,
MHD_HTTP_OK,
"DS-1",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:1.0"),
TALER_TESTING_cmd_merchant_post_orders ("create-proposal-double-spend-1",
twister_merchant_url,
MHD_HTTP_OK,
"DS-2",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:3.0"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-double-spend",
@@ -376,8 +376,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"1",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:6.0"),
TALER_TESTING_cmd_flip_upload ("hack-claim-token",
PROXY_MERCHANT_CONFIG_FILE,
@@ -392,8 +392,8 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"2",
- GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
"EUR:6.0"),
TALER_TESTING_cmd_merchant_pay_order ("deposit-2",
merchant_url,
diff --git a/src/testing/testing_api_cmd_get_orders.c b/src/testing/testing_api_cmd_get_orders.c
index 6e1ca622..5abe92ab 100644
--- a/src/testing/testing_api_cmd_get_orders.c
+++ b/src/testing/testing_api_cmd_get_orders.c
@@ -376,9 +376,11 @@ conclude_task (void *cls)
TALER_TESTING_FAIL (poc->is);
}
now = GNUNET_TIME_absolute_get ();
- if ((GNUNET_TIME_absolute_add (pos->deadline,
- GNUNET_TIME_UNIT_SECONDS).abs_value_us <
- now.abs_value_us) )
+ if (GNUNET_TIME_absolute_cmp (GNUNET_TIME_absolute_add (
+ pos->deadline,
+ GNUNET_TIME_UNIT_SECONDS),
+ <,
+ now))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Expected answer to be delayed until %llu, but got response at %llu\n",
@@ -455,15 +457,16 @@ merchant_poll_orders_start_run (void *cls,
/* add 1s grace time to timeout */
pos->deadline
- = GNUNET_TIME_absolute_add (GNUNET_TIME_relative_to_absolute (pos->timeout),
- GNUNET_TIME_UNIT_SECONDS);
+ = GNUNET_TIME_relative_to_absolute (
+ GNUNET_TIME_relative_add (pos->timeout,
+ GNUNET_TIME_UNIT_SECONDS));
pos->is = is;
pos->ogh = TALER_MERCHANT_orders_get2 (is->ctx,
pos->merchant_url,
TALER_EXCHANGE_YNA_ALL,
TALER_EXCHANGE_YNA_ALL,
TALER_EXCHANGE_YNA_ALL,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
1,
2,
pos->timeout,
diff --git a/src/testing/testing_api_cmd_get_product.c b/src/testing/testing_api_cmd_get_product.c
index 7f46a5f3..ece36e71 100644
--- a/src/testing/testing_api_cmd_get_product.c
+++ b/src/testing/testing_api_cmd_get_product.c
@@ -104,7 +104,7 @@ get_product_cb (void *cls,
uint64_t total_sold,
uint64_t total_lost,
const json_t *location,
- struct GNUNET_TIME_Absolute next_restock)
+ struct GNUNET_TIME_Timestamp next_restock)
{
struct GetProductState *gis = cls;
const struct TALER_TESTING_Command *product_cmd;
@@ -256,16 +256,16 @@ get_product_cb (void *cls,
}
}
{
- const struct GNUNET_TIME_Absolute *expected_next_restock;
- struct GNUNET_TIME_Absolute expected_next_restock_round;
+ const struct GNUNET_TIME_Timestamp *expected_next_restock;
+
if (GNUNET_OK !=
- TALER_TESTING_get_trait_absolute_time (product_cmd,
- 0,
- &expected_next_restock))
+ TALER_TESTING_get_trait_timestamp (product_cmd,
+ 0,
+ &expected_next_restock))
TALER_TESTING_interpreter_fail (gis->is);
- expected_next_restock_round = *expected_next_restock;
- GNUNET_TIME_round_abs (&expected_next_restock_round);
- if (next_restock.abs_value_us != expected_next_restock_round.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (next_restock,
+ !=,
+ *expected_next_restock))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Product next restock does not match\n");
diff --git a/src/testing/testing_api_cmd_get_reserves.c b/src/testing/testing_api_cmd_get_reserves.c
index dd0101b7..d56b9ce5 100644
--- a/src/testing/testing_api_cmd_get_reserves.c
+++ b/src/testing/testing_api_cmd_get_reserves.c
@@ -197,7 +197,7 @@ get_reserves_run (void *cls,
grs->is = is;
grs->rgh = TALER_MERCHANT_reserves_get (is->ctx,
grs->merchant_url,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
TALER_EXCHANGE_YNA_ALL,
TALER_EXCHANGE_YNA_ALL,
&get_reserves_cb,
diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c
index 59e0ecf8..fe50c349 100644
--- a/src/testing/testing_api_cmd_get_transfers.c
+++ b/src/testing/testing_api_cmd_get_transfers.c
@@ -225,20 +225,21 @@ get_transfers_cb (
}
}
{
- const struct GNUNET_TIME_Absolute *execution_time;
+ const struct GNUNET_TIME_Timestamp *execution_time;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_absolute_time (transfer_cmd,
- 0,
- &execution_time))
+ TALER_TESTING_get_trait_timestamp (transfer_cmd,
+ 0,
+ &execution_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not fetch wire transfer execution time\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- if (execution_time->abs_value_us !=
- transfers[i].execution_time.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*execution_time,
+ !=,
+ transfers[i].execution_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer execution time does not match\n");
@@ -274,8 +275,8 @@ get_transfers_run (void *cls,
gts->gth = TALER_MERCHANT_transfers_get (is->ctx,
gts->merchant_url,
gts->payto_uri,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
+ GNUNET_TIME_UNIT_ZERO_TS,
INT64_MAX,
0,
TALER_EXCHANGE_YNA_ALL,
diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c b/src/testing/testing_api_cmd_merchant_get_tip.c
index 81be677d..6b247e75 100644
--- a/src/testing/testing_api_cmd_merchant_get_tip.c
+++ b/src/testing/testing_api_cmd_merchant_get_tip.c
@@ -94,7 +94,7 @@ merchant_get_tip_cb (void *cls,
const struct TALER_Amount *total_authorized,
const struct TALER_Amount *total_picked_up,
const char *reason,
- struct GNUNET_TIME_Absolute expiration,
+ struct GNUNET_TIME_Timestamp expiration,
const struct TALER_ReservePublicKeyP *reserve_pub,
unsigned int pickups_length,
const struct TALER_MERCHANT_PickupDetail pickups[])
@@ -108,8 +108,9 @@ merchant_get_tip_cb (void *cls,
gts->tip_reference);
gts->tgh = NULL;
- GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (total_picked_up->currency,
- &expected_total_picked_up));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (total_picked_up->currency,
+ &expected_total_picked_up));
if (gts->http_status != hr->http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -161,14 +162,16 @@ merchant_get_tip_cb (void *cls,
}
}
{
- const struct GNUNET_TIME_Absolute *tip_expiration;
+ const struct GNUNET_TIME_Timestamp *tip_expiration;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_absolute_time (authorize_cmd,
- 0,
- &tip_expiration))
+ TALER_TESTING_get_trait_timestamp (authorize_cmd,
+ 0,
+ &tip_expiration))
TALER_TESTING_FAIL (gts->is);
- if (tip_expiration->abs_value_us != expiration.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*tip_expiration,
+ !=,
+ expiration))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Tip authorized expiration does not match\n");
diff --git a/src/testing/testing_api_cmd_patch_product.c b/src/testing/testing_api_cmd_patch_product.c
index 41d992e2..4715ce1f 100644
--- a/src/testing/testing_api_cmd_patch_product.c
+++ b/src/testing/testing_api_cmd_patch_product.c
@@ -102,7 +102,7 @@ struct PatchProductState
/**
* when the next restocking is expected to happen, 0 for unknown,
*/
- struct GNUNET_TIME_Absolute next_restock;
+ struct GNUNET_TIME_Timestamp next_restock;
/**
* Expected HTTP response code.
@@ -218,8 +218,8 @@ patch_product_traits (void *cls,
TALER_TESTING_make_trait_taxes (pps->taxes),
TALER_TESTING_make_trait_product_stock (&pps->total_stock),
TALER_TESTING_make_trait_address (pps->address),
- TALER_TESTING_make_trait_absolute_time (0,
- &pps->next_restock),
+ TALER_TESTING_make_trait_timestamp (0,
+ &pps->next_restock),
TALER_TESTING_make_trait_product_id (&pps->product_id),
TALER_TESTING_trait_end (),
};
@@ -272,7 +272,7 @@ TALER_TESTING_cmd_merchant_patch_product (
int64_t total_stock,
uint64_t total_lost,
json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
unsigned int http_status)
{
struct PatchProductState *pis;
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
index 6087ef2b..736b482c 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -256,9 +256,9 @@ pay_run (void *cls,
const struct TALER_TESTING_Command *proposal_cmd;
const json_t *contract_terms;
const char *order_id;
- struct GNUNET_TIME_Absolute refund_deadline;
- struct GNUNET_TIME_Absolute pay_deadline;
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp refund_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
+ struct GNUNET_TIME_Timestamp timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_MerchantWireHash h_wire;
const struct TALER_PrivateContractHash *h_proposal;
@@ -288,12 +288,12 @@ pay_run (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("order_id",
&order_id),
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline),
- TALER_JSON_spec_absolute_time ("pay_deadline",
- &pay_deadline),
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline),
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &pay_deadline),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
&merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_wire",
diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c
index 81b79091..bb31dacc 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -377,11 +377,10 @@ orders_run (void *cls,
struct GNUNET_TIME_Absolute now;
char *order_id;
- // FIXME: should probably use get_monotone() to ensure uniqueness!
- now = GNUNET_TIME_absolute_get ();
- order_id = GNUNET_STRINGS_data_to_string_alloc
- (&now.abs_value_us,
- sizeof (now.abs_value_us));
+ now = GNUNET_TIME_absolute_get_monotonic (is->cfg);
+ order_id = GNUNET_STRINGS_data_to_string_alloc (
+ &now,
+ sizeof (now));
GNUNET_assert (0 ==
json_object_set_new (ps->order_terms,
"order_id",
@@ -451,8 +450,7 @@ orders_run2 (void *cls,
struct GNUNET_TIME_Absolute now;
char *order_id;
- // FIXME: should probably use get_monotone() to ensure uniqueness!
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_absolute_get_monotonic (is->cfg);
order_id = GNUNET_STRINGS_data_to_string_alloc (
&now.abs_value_us,
sizeof (now.abs_value_us));
@@ -621,18 +619,15 @@ mark_forgettable (void *cls,
*/
static void
make_order_json (const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount,
json_t **order)
{
- struct GNUNET_TIME_Absolute refund = refund_deadline;
- struct GNUNET_TIME_Absolute pay = pay_deadline;
+ struct GNUNET_TIME_Timestamp refund = refund_deadline;
+ struct GNUNET_TIME_Timestamp pay = pay_deadline;
json_t *contract_terms;
- GNUNET_TIME_round_abs (&refund);
- GNUNET_TIME_round_abs (&pay);
-
/* Include required fields and some dummy objects to test forgetting. */
contract_terms = json_pack (
"{s:s, s:s?, s:s, s:s, s:o, s:o, s:s, s:[{s:s}, {s:s}, {s:s}]}",
@@ -640,8 +635,8 @@ make_order_json (const char *order_id,
"order_id", order_id,
"amount", amount,
"fulfillment_url", "https://example.com",
- "refund_deadline", GNUNET_JSON_from_time_abs (refund),
- "pay_deadline", GNUNET_JSON_from_time_abs (pay),
+ "refund_deadline", GNUNET_JSON_from_timestamp (refund),
+ "pay_deadline", GNUNET_JSON_from_timestamp (pay),
"dummy_obj", "EUR:1.0",
"dummy_array", /* For testing forgetting parts of arrays */
"item", "speakers",
@@ -668,8 +663,8 @@ TALER_TESTING_cmd_merchant_post_orders_no_claim (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount)
{
struct OrdersState *ps;
@@ -704,8 +699,8 @@ TALER_TESTING_cmd_merchant_post_orders (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount)
{
struct OrdersState *ps;
@@ -740,8 +735,8 @@ TALER_TESTING_cmd_merchant_post_orders2 (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
bool claim_token,
const char *amount,
const char *payment_target,
diff --git a/src/testing/testing_api_cmd_post_products.c b/src/testing/testing_api_cmd_post_products.c
index 372a5fab..be3c3071 100644
--- a/src/testing/testing_api_cmd_post_products.c
+++ b/src/testing/testing_api_cmd_post_products.c
@@ -97,7 +97,7 @@ struct PostProductsState
/**
* when the next restocking is expected to happen, 0 for unknown,
*/
- struct GNUNET_TIME_Absolute next_restock;
+ struct GNUNET_TIME_Timestamp next_restock;
/**
* Expected HTTP response code.
@@ -213,8 +213,8 @@ post_products_traits (void *cls,
TALER_TESTING_make_trait_taxes (pps->taxes),
TALER_TESTING_make_trait_product_stock (&pps->total_stock),
TALER_TESTING_make_trait_address (pps->address),
- TALER_TESTING_make_trait_absolute_time (0,
- &pps->next_restock),
+ TALER_TESTING_make_trait_timestamp (0,
+ &pps->next_restock),
TALER_TESTING_make_trait_product_id (&pps->product_id),
TALER_TESTING_trait_end (),
};
@@ -266,7 +266,7 @@ TALER_TESTING_cmd_merchant_post_products2 (
json_t *taxes,
int64_t total_stock,
json_t *address,
- struct GNUNET_TIME_Absolute next_restock,
+ struct GNUNET_TIME_Timestamp next_restock,
unsigned int http_status)
{
struct PostProductsState *pis;
@@ -324,7 +324,7 @@ TALER_TESTING_cmd_merchant_post_products (const char *label,
json_array (),
4,
json_pack ("{s:s}", "street", "my street"),
- GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_ZERO_TS,
http_status);
}
diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c
index 77a2456b..571cfb9a 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -118,7 +118,7 @@ struct PostTransfersState
/**
* When the exchange executed the transfer.
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
};
@@ -140,7 +140,7 @@ struct PostTransfersState
static void
transfers_cb (void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
- struct GNUNET_TIME_Absolute execution_time,
+ struct GNUNET_TIME_Timestamp execution_time,
const struct TALER_Amount *total_amount,
const struct TALER_Amount *wire_fee,
unsigned int details_length,
@@ -347,8 +347,8 @@ post_transfers_traits (void *cls,
TALER_TESTING_make_trait_fee (&pts->wire_fee),
TALER_TESTING_make_trait_exchange_url (
(const char **) &pts->exchange_url),
- TALER_TESTING_make_trait_absolute_time (0,
- &pts->execution_time),
+ TALER_TESTING_make_trait_timestamp (0,
+ &pts->execution_time),
TALER_TESTING_make_trait_bank_row (&pts->serial),
TALER_TESTING_trait_end (),
};
diff --git a/src/testing/testing_api_cmd_tip_authorize.c b/src/testing/testing_api_cmd_tip_authorize.c
index 4be6b30a..cc83605f 100644
--- a/src/testing/testing_api_cmd_tip_authorize.c
+++ b/src/testing/testing_api_cmd_tip_authorize.c
@@ -81,7 +81,7 @@ struct TipAuthorizeState
/**
* Expiration date for this tip.
*/
- struct GNUNET_TIME_Absolute tip_expiration;
+ struct GNUNET_TIME_Timestamp tip_expiration;
/**
* Handle to the on-going /tip-authorize request.
@@ -136,7 +136,7 @@ tip_authorize_cb (void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
struct GNUNET_HashCode *tip_id,
const char *taler_tip_uri,
- struct GNUNET_TIME_Absolute expiration)
+ struct GNUNET_TIME_Timestamp expiration)
{
struct TipAuthorizeState *tas = cls;
@@ -209,8 +209,8 @@ tip_authorize_traits (void *cls,
TALER_TESTING_make_trait_tip_id (&tas->tip_id),
TALER_TESTING_make_trait_amount (&tas->amount),
TALER_TESTING_make_trait_reason (&tas->justification),
- TALER_TESTING_make_trait_absolute_time (0,
- &tas->tip_expiration),
+ TALER_TESTING_make_trait_timestamp (0,
+ &tas->tip_expiration),
TALER_TESTING_trait_end (),
};
diff --git a/src/testing/testing_api_cmd_wallet_get_tip.c b/src/testing/testing_api_cmd_wallet_get_tip.c
index d08e4bcb..7e13acc9 100644
--- a/src/testing/testing_api_cmd_wallet_get_tip.c
+++ b/src/testing/testing_api_cmd_wallet_get_tip.c
@@ -85,7 +85,7 @@ struct WalletTipGetState
static void
wallet_tip_get_cb (void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
- struct GNUNET_TIME_Absolute reserve_expiration,
+ struct GNUNET_TIME_Timestamp reserve_expiration,
const char *exchange_url,
const struct TALER_Amount *amount_remaining)
{
@@ -127,14 +127,16 @@ wallet_tip_get_cb (void *cls,
}
}
{
- const struct GNUNET_TIME_Absolute *expiration;
+ const struct GNUNET_TIME_Timestamp *expiration;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_absolute_time (tip_cmd,
- 0,
- &expiration))
+ TALER_TESTING_get_trait_timestamp (tip_cmd,
+ 0,
+ &expiration))
TALER_TESTING_interpreter_fail (gts->is);
- if (expiration->abs_value_us != reserve_expiration.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*expiration,
+ !=,
+ reserve_expiration))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Tip expiration does not match\n");