From 3d7fefedc9ba60bd8e8448efe8b628446d958536 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 11 Aug 2013 21:21:56 +0000 Subject: changing time measurement from milliseconds to microseconds --- src/datastore/datastore_api.c | 20 ++++++++------ src/datastore/gnunet-service-datastore.c | 24 ++++++++++------- src/datastore/perf_datastore_api.c | 8 +++--- src/datastore/perf_plugin_datastore.c | 39 ++++++++++++++++----------- src/datastore/plugin_datastore_heap.c | 6 ++--- src/datastore/plugin_datastore_mysql.c | 19 +++++++------ src/datastore/plugin_datastore_postgres.c | 10 +++---- src/datastore/plugin_datastore_sqlite.c | 19 ++++++------- src/datastore/test_datastore_api.c | 13 ++++----- src/datastore/test_datastore_api_management.c | 4 +-- src/datastore/test_plugin_datastore.c | 5 ++-- 11 files changed, 95 insertions(+), 72 deletions(-) (limited to 'src/datastore') diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index fab3bf0ca..2fb250b96 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c @@ -850,9 +850,10 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid, union QueueContext qc; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Asked to put %u bytes of data under key `%s' for %llu ms\n", size, + "Asked to put %u bytes of data under key `%s' for %s\n", size, GNUNET_h2s (key), - GNUNET_TIME_absolute_get_remaining (expiration).rel_value); + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), + GNUNET_YES)); msize = sizeof (struct DataMessage) + size; GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); qc.sc.cont = cont; @@ -1037,8 +1038,10 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid, if (cont == NULL) cont = &drop_status_cont; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Asked to update entry %llu raising priority by %u and expiration to %llu\n", - uid, (unsigned int) priority, (unsigned long long) expiration.abs_value); + "Asked to update entry %llu raising priority by %u and expiration to %s\n", + uid, + (unsigned int) priority, + GNUNET_STRINGS_absolute_time_to_string (expiration)); qc.sc.cont = cont; qc.sc.cont_cls = cont_cls; qe = make_queue_entry (h, sizeof (struct UpdateMessage), queue_priority, @@ -1268,8 +1271,9 @@ GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, union QueueContext qc; GNUNET_assert (NULL != proc); - LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to get replication entry in %llu ms\n", - (unsigned long long) timeout.rel_value); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Asked to get replication entry in %s\n", + GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); qc.rc.proc = proc; qc.rc.proc_cls = proc_cls; qe = make_queue_entry (h, sizeof (struct GNUNET_MessageHeader), @@ -1330,9 +1334,9 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, GNUNET_assert (NULL != proc); GNUNET_assert (type != GNUNET_BLOCK_TYPE_ANY); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Asked to get %llu-th zero-anonymity entry of type %d in %llu ms\n", + "Asked to get %llu-th zero-anonymity entry of type %d in %s\n", (unsigned long long) offset, type, - (unsigned long long) timeout.rel_value); + GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); qc.rc.proc = proc; qc.rc.proc_cls = proc_cls; qe = make_queue_entry (h, sizeof (struct GetZeroAnonymityMessage), diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 93b43b16c..f6018b7b5 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -332,7 +332,7 @@ expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, return GNUNET_SYSERR; } now = GNUNET_TIME_absolute_get (); - if (expiration.abs_value > now.abs_value) + if (expiration.abs_value_us > now.abs_value_us) { /* finished processing */ expired_kill_task = @@ -342,9 +342,11 @@ expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, return GNUNET_SYSERR; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Deleting content `%s' of type %u that expired %llu ms ago\n", + "Deleting content `%s' of type %u that expired %s ago\n", GNUNET_h2s (key), type, - (unsigned long long) (now.abs_value - expiration.abs_value)); + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (expiration, + now), + GNUNET_YES)); min_expiration = now; GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size, GNUNET_YES); @@ -404,11 +406,12 @@ quota_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, if (NULL == key) return GNUNET_SYSERR; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %llu ms prior to expiration (still trying to free another %llu bytes)\n", + "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n", (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), (unsigned int) priority, GNUNET_h2s (key), type, - (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).rel_value, + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), + GNUNET_YES), *need); if (size + GNUNET_DATASTORE_ENTRY_OVERHEAD > *need) *need = 0; @@ -619,10 +622,11 @@ transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size, dm->key = *key; memcpy (&dm[1], data, size); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Transmitting `%s' message for `%s' of type %u with expiration %llu (now: %llu)\n", + "Transmitting `%s' message for `%s' of type %u with expiration %s (in: %s)\n", "DATA", GNUNET_h2s (key), type, - (unsigned long long) expiration.abs_value, - (unsigned long long) GNUNET_TIME_absolute_get ().abs_value); + GNUNET_STRINGS_absolute_time_to_string (expiration), + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), + GNUNET_YES)); GNUNET_STATISTICS_update (stats, gettext_noop ("# results found"), 1, GNUNET_NO); transmit (client, &dm->header); @@ -896,8 +900,8 @@ check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size, "Result already present in datastore\n"); /* FIXME: change API to allow increasing 'replication' counter */ if ((ntohl (dm->priority) > 0) || - (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value > - expiration.abs_value)) + (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us > + expiration.abs_value_us)) plugin->api->update (plugin->api->cls, uid, (int32_t) ntohl (dm->priority), GNUNET_TIME_absolute_ntoh (dm->expiration), NULL); diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index cf21ebe44..83be3ad5f 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c @@ -245,9 +245,9 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) #endif "Stored %llu kB / %lluk ops / %llu ops/s\n", stored_bytes / 1024, /* used size in k */ stored_ops / 1024, /* total operations (in k) */ - 1000 * stored_ops / (1 + - GNUNET_TIME_absolute_get_duration - (start_time).rel_value)); + 1000LL * 1000LL * stored_ops / (1 + + GNUNET_TIME_absolute_get_duration + (start_time).rel_value_us)); crc->phase = RP_PUT; crc->j = 0; GNUNET_SCHEDULER_add_continuation (&run_continuation, crc, @@ -257,7 +257,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_snprintf (gstr, sizeof (gstr), "DATASTORE-%s", plugin_name); if ((crc->i == ITERATIONS) && (stored_ops > 0)) GAUGER (gstr, "PUT operation duration", - GNUNET_TIME_absolute_get_duration (start_time).rel_value / + GNUNET_TIME_absolute_get_duration (start_time).rel_value_us / 1000LL / stored_ops, "ms/operation"); GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); GNUNET_free (crc); diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 322ca26b2..657acc66b 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c @@ -115,7 +115,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k) size = size - (size & 7); /* always multiple of 8 */ /* generate random key */ - key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value; + key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value_us; GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key); memset (value, i, size); if (i > 255) @@ -164,9 +164,10 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size, hits[i / 8] |= (1 << (i % 8)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found result %d type=%u, priority=%u, size=%u, expire=%llu\n", + "Found result %d type=%u, priority=%u, size=%u, expire=%s\n", i, - type, priority, size, (unsigned long long) expiration.abs_value); + type, priority, size, + GNUNET_STRINGS_absolute_time_to_string (expiration)); crc->cnt++; if (crc->cnt == PUT_10 / 4 - 1) { @@ -178,13 +179,15 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size, bc++; crc->end = GNUNET_TIME_absolute_get (); - printf ("%s took %llu ms yielding %u/%u items\n", + printf ("%s took %s yielding %u/%u items\n", "Select random zero-anonymity item", - (unsigned long long) (crc->end.abs_value - crc->start.abs_value), + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, + crc->end), + GNUNET_YES), bc, crc->cnt); if (crc->cnt > 0) GAUGER (category, "Select random zero-anonymity item", - (crc->end.abs_value - crc->start.abs_value) / crc->cnt, + (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt, "ms/item"); memset (hits, 0, sizeof (hits)); crc->phase++; @@ -220,13 +223,15 @@ expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size, bc++; crc->end = GNUNET_TIME_absolute_get (); - printf ("%s took %llu ms yielding %u/%u items\n", + printf ("%s took %s yielding %u/%u items\n", "Selecting and deleting by expiration", - (unsigned long long) (crc->end.abs_value - crc->start.abs_value), + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, + crc->end), + GNUNET_YES), bc, (unsigned int) PUT_10); if (crc->cnt > 0) GAUGER (category, "Selecting and deleting by expiration", - (crc->end.abs_value - crc->start.abs_value) / crc->cnt, + (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt, "ms/item"); memset (hits, 0, sizeof (hits)); if (++crc->iter == ITERATIONS) @@ -266,13 +271,15 @@ replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size, bc++; crc->end = GNUNET_TIME_absolute_get (); - printf ("%s took %llu ms yielding %u/%u items\n", + printf ("%s took %s yielding %u/%u items\n", "Selecting random item for replication", - (unsigned long long) (crc->end.abs_value - crc->start.abs_value), + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, + crc->end), + GNUNET_YES), bc, (unsigned int) PUT_10); if (crc->cnt > 0) GAUGER (category, "Selecting random item for replication", - (crc->end.abs_value - crc->start.abs_value) / crc->cnt, + (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt, "ms/item"); memset (hits, 0, sizeof (hits)); crc->phase++; @@ -359,12 +366,14 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) putValue (crc->api, j, crc->i); crc->end = GNUNET_TIME_absolute_get (); { - printf ("%s took %llu ms for %llu items\n", "Storing an item", - (unsigned long long) (crc->end.abs_value - crc->start.abs_value), + printf ("%s took %s for %llu items\n", "Storing an item", + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, + crc->end), + GNUNET_YES), PUT_10); if (PUT_10 > 0) GAUGER (category, "Storing an item", - (crc->end.abs_value - crc->start.abs_value) / PUT_10, + (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / PUT_10, "ms/item"); } crc->i++; diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c index 9f9360bfb..79dcb9043 100644 --- a/src/datastore/plugin_datastore_heap.c +++ b/src/datastore/plugin_datastore_heap.c @@ -226,7 +226,7 @@ heap_plugin_put (void *cls, value->data = &value[1]; value->expire_heap = GNUNET_CONTAINER_heap_insert (plugin->by_expiration, value, - expiration.abs_value); + expiration.abs_value_us); value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, value, replication); @@ -628,12 +628,12 @@ heap_plugin_update (void *cls, value = (struct Value*) (long) uid; GNUNET_assert (NULL != value); - if (value->expiration.abs_value != expire.abs_value) + if (value->expiration.abs_value_us != expire.abs_value_us) { value->expiration = expire; GNUNET_CONTAINER_heap_update_cost (plugin->by_expiration, value->expire_heap, - expire.abs_value); + expire.abs_value_us); } if ( (delta < 0) && (value->priority < - delta) ) value->priority = 0; diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index ad70e73d4..40f25deee 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c @@ -290,7 +290,7 @@ mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, unsigned int irepl = replication; unsigned int ipriority = priority; unsigned int ianonymity = anonymity; - unsigned long long lexpiration = expiration.abs_value; + unsigned long long lexpiration = expiration.abs_value_us; unsigned long long lrvalue = (unsigned long long) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); @@ -358,12 +358,13 @@ mysql_plugin_update (void *cls, uint64_t uid, int delta, { struct Plugin *plugin = cls; unsigned long long vkey = uid; - unsigned long long lexpire = expire.abs_value; + unsigned long long lexpire = expire.abs_value_us; int ret; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Updating value %llu adding %d to priority and maxing exp at %llu\n", - vkey, delta, lexpire); + "Updating value %llu adding %d to priority and maxing exp at %s\n", + vkey, delta, + GNUNET_STRINGS_absolute_time_to_string (expire)); ret = GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, MYSQL_TYPE_LONG, &delta, GNUNET_NO, @@ -449,11 +450,13 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } + expiration.abs_value_us = exp; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found %u-byte value under key `%s' with prio %u, anon %u, expire %llu selecting from gn090 table\n", - (unsigned int) size, GNUNET_h2s (&key), priority, anonymity, exp); + "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n", + (unsigned int) size, GNUNET_h2s (&key), + priority, anonymity, + GNUNET_STRINGS_absolute_time_to_string (expiration)); GNUNET_assert (size < MAX_DATUM_SIZE); - expiration.abs_value = exp; ret = proc (proc_cls, &key, size, value, type, priority, anonymity, expiration, uid); @@ -907,7 +910,7 @@ mysql_plugin_get_expiration (void *cls, PluginDatumProcessor proc, rc.plugin = plugin; rc.proc = proc; rc.proc_cls = proc_cls; - nt = (long long) GNUNET_TIME_absolute_get ().abs_value; + nt = (long long) GNUNET_TIME_absolute_get ().abs_value_us; execute_select (plugin, plugin->select_expiration, expi_proc, &rc, MYSQL_TYPE_LONGLONG, &nt, GNUNET_YES, -1); diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 83fc423da..98109d4da 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) + (C) 2009-2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -283,7 +283,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t siz uint32_t bprio = htonl (priority); uint32_t banon = htonl (anonymity); uint32_t brepl = htonl (replication); - uint64_t bexpi = GNUNET_TIME_absolute_hton (expiration).abs_value__; + uint64_t bexpi = GNUNET_TIME_absolute_hton (expiration).abs_value_us__; const char *paramValues[] = { (const char *) &brepl, @@ -392,7 +392,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, type = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); priority = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); - expiration_time.abs_value = + expiration_time.abs_value_us = GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3)); memcpy (&key, PQgetvalue (res, 0, 4), sizeof (struct GNUNET_HashCode)); size = PQgetlength (res, 0, 5); @@ -712,7 +712,7 @@ postgres_plugin_get_expiration (void *cls, PluginDatumProcessor proc, const char *paramValues[] = { (const char *) &btime }; PGresult *ret; - btime = GNUNET_htonll (GNUNET_TIME_absolute_get ().abs_value); + btime = GNUNET_htonll (GNUNET_TIME_absolute_get ().abs_value_us); ret = PQexecPrepared (plugin->dbh, "select_expiration_order", 1, paramValues, paramLengths, paramFormats, 1); @@ -751,7 +751,7 @@ postgres_plugin_update (void *cls, uint64_t uid, int delta, PGresult *ret; int32_t bdelta = (int32_t) htonl ((uint32_t) delta); uint32_t boid = htonl ((uint32_t) uid); - uint64_t bexpire = GNUNET_TIME_absolute_hton (expire).abs_value__; + uint64_t bexpire = GNUNET_TIME_absolute_hton (expire).abs_value_us__; const char *paramValues[] = { (const char *) &bdelta, diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index e77e8b9fa..9a4b40255 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -488,11 +488,12 @@ sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, if (size > MAX_ITEM_SIZE) return GNUNET_SYSERR; GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", - "Storing in database block with type %u/key `%s'/priority %u/expiration in %llu ms (%lld).\n", + "Storing in database block with type %u/key `%s'/priority %u/expiration in %s (%s).\n", type, GNUNET_h2s (key), priority, (unsigned long long) - GNUNET_TIME_absolute_get_remaining (expiration).rel_value, - (long long) expiration.abs_value); + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), + GNUNET_YES), + GNUNET_STRINGS_absolute_time_to_string (expiration)); GNUNET_CRYPTO_hash (data, size, &vhash); stmt = plugin->insertContent; rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); @@ -500,7 +501,7 @@ sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || (SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) || (SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) || - (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) || + (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value_us)) || (SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) || (SQLITE_OK != sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode), @@ -583,7 +584,7 @@ sqlite_plugin_update (void *cls, uint64_t uid, int delta, int n; if ((SQLITE_OK != sqlite3_bind_int (plugin->updPrio, 1, delta)) || - (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value)) + (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value_us)) || (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 3, uid))) { LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, @@ -655,10 +656,10 @@ execute_get (struct Plugin *plugin, sqlite3_stmt * stmt, -(size + GNUNET_DATASTORE_ENTRY_OVERHEAD)); break; } - expiration.abs_value = sqlite3_column_int64 (stmt, 3); + expiration.abs_value_us = sqlite3_column_int64 (stmt, 3); GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", - "Found reply in database with expiration %llu\n", - (unsigned long long) expiration.abs_value); + "Found reply in database with expiration %s\n", + GNUNET_STRINGS_absolute_time_to_string (expiration)); ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ , size, sqlite3_column_blob (stmt, 5) /* data */ , sqlite3_column_int (stmt, 0) /* type */ , @@ -1040,7 +1041,7 @@ sqlite_plugin_get_expiration (void *cls, PluginDatumProcessor proc, "Getting random block based on expiration and priority order.\n"); now = GNUNET_TIME_absolute_get (); stmt = plugin->selExpi; - if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value)) + if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value_us)) { LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 66ba416af..a88dd0c20 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c @@ -94,7 +94,7 @@ get_expiration (int i) { struct GNUNET_TIME_Absolute av; - av.abs_value = now.abs_value + 20000000 - i * 1000; + av.abs_value_us = now.abs_value_us + 20000000000LL - i * 1000 * 1000LL; return av; } @@ -191,20 +191,21 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, return; } #if 0 - FPRINTF (stderr, "Check value got `%s' of size %u, type %d, expire %llu\n", + FPRINTF (stderr, + "Check value got `%s' of size %u, type %d, expire %s\n", GNUNET_h2s (key), (unsigned int) size, type, - (unsigned long long) expiration.abs_value); + GNUNET_STRINGS_absolute_time_to_string (expiration)); FPRINTF (stderr, - "Check value iteration %d wants size %u, type %d, expire %llu\n", i, + "Check value iteration %d wants size %u, type %d, expire %s\n", i, (unsigned int) get_size (i), get_type (i), - (unsigned long long) get_expiration (i).abs_value); + GNUNET_STRINGS_absolute_time_to_string (get_expiration(i))); #endif GNUNET_assert (size == get_size (i)); GNUNET_assert (0 == memcmp (data, get_data (i), size)); GNUNET_assert (type == get_type (i)); GNUNET_assert (priority == get_priority (i)); GNUNET_assert (anonymity == get_anonymity (i)); - GNUNET_assert (expiration.abs_value == get_expiration (i).abs_value); + GNUNET_assert (expiration.abs_value_us == get_expiration (i).abs_value_us); crc->offset++; if (crc->i == 0) { diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 9eae32f4a..8baeeede8 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c @@ -113,7 +113,7 @@ get_expiration (int i) { struct GNUNET_TIME_Absolute av; - av.abs_value = now.abs_value + i * 1000; + av.abs_value_us = now.abs_value_us + i * 1000 * 1000LL; return av; } @@ -159,7 +159,7 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, GNUNET_assert (type == get_type (i)); GNUNET_assert (priority == get_priority (i)); GNUNET_assert (anonymity == get_anonymity (i)); - GNUNET_assert (expiration.abs_value == get_expiration (i).abs_value); + GNUNET_assert (expiration.abs_value_us == get_expiration (i).abs_value_us); crc->offset++; crc->i--; if (crc->i == 0) diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index adfacef0c..3efd7b4ce 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c @@ -158,8 +158,9 @@ iterate_one_shot (void *cls, const struct GNUNET_HashCode * key, uint32_t size, guid = uid; crc->phase++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n", - type, priority, size, (unsigned long long) expiration.abs_value, + "Found result type=%u, priority=%u, size=%u, expire=%s, key %s\n", + type, priority, size, + GNUNET_STRINGS_absolute_time_to_string (expiration), GNUNET_h2s (key)); GNUNET_SCHEDULER_add_now (&test, crc); return GNUNET_OK; -- cgit v1.2.3