From 1b899f6e899047a521d473d00492bcf699f44ede Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 30 Jul 2014 09:30:35 +0200 Subject: [PATCH] time: Renamed PRIscTIME to PRIsdbTIME. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Another remnant of the “syscollector” days ;-) --- src/backend/collectd/unixsock.c | 2 +- src/backend/mk-livestatus.c | 4 ++-- src/backend/puppet/store-configs.c | 2 +- src/core/store.c | 2 +- src/core/time.c | 6 +++--- src/include/core/time.h | 2 +- t/unit/core/store_test.c | 12 ++++++------ t/unit/core/time_test.c | 6 +++--- t/unit/utils/dbi_test.c | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/backend/collectd/unixsock.c b/src/backend/collectd/unixsock.c index b8bbbfe..07da8c0 100644 --- a/src/backend/collectd/unixsock.c +++ b/src/backend/collectd/unixsock.c @@ -106,7 +106,7 @@ sdb_collectd_store_host(sdb_collectd_state_t *state, return 0; sdb_log(SDB_LOG_DEBUG, "collectd::unixsock backend: Added/updated " - "host '%s' (last update timestamp = %"PRIscTIME").", + "host '%s' (last update timestamp = %"PRIsdbTIME").", hostname, last_update); return 0; } /* sdb_collectd_store_host */ diff --git a/src/backend/mk-livestatus.c b/src/backend/mk-livestatus.c index 6481807..0f94ce3 100644 --- a/src/backend/mk-livestatus.c +++ b/src/backend/mk-livestatus.c @@ -79,7 +79,7 @@ sdb_livestatus_get_host(sdb_unixsock_client_t __attribute__((unused)) *client, return 0; sdb_log(SDB_LOG_DEBUG, "MK Livestatus backend: Added/updated " - "host '%s' (last update timestamp = %"PRIscTIME").", + "host '%s' (last update timestamp = %"PRIsdbTIME").", hostname, timestamp); return 0; } /* sdb_livestatus_get_host */ @@ -115,7 +115,7 @@ sdb_livestatus_get_svc(sdb_unixsock_client_t __attribute__((unused)) *client, return 0; sdb_log(SDB_LOG_DEBUG, "MK Livestatus backend: Added/updated " - "service '%s / %s' (last update timestamp = %"PRIscTIME").", + "service '%s / %s' (last update timestamp = %"PRIsdbTIME").", hostname, svcname, timestamp); return 0; } /* sdb_livestatus_get_svc */ diff --git a/src/backend/puppet/store-configs.c b/src/backend/puppet/store-configs.c index ebe5dbd..5efc531 100644 --- a/src/backend/puppet/store-configs.c +++ b/src/backend/puppet/store-configs.c @@ -72,7 +72,7 @@ sdb_puppet_stcfg_get_hosts(sdb_dbi_client_t __attribute__((unused)) *client, else if (! status) sdb_log(SDB_LOG_DEBUG, "puppet::store-configs backend: " "Added/updated host '%s' (last update timestamp = " - "%"PRIscTIME").", hostname, timestamp); + "%"PRIsdbTIME").", hostname, timestamp); return 0; } /* sdb_puppet_stcfg_get_hosts */ diff --git a/src/core/store.c b/src/core/store.c index cc0927e..ee861d3 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -255,7 +255,7 @@ store_obj(sdb_avltree_t *parent_tree, int type, const char *name, if (old) { if (old->last_update > last_update) { sdb_log(SDB_LOG_DEBUG, "store: Cannot update %s '%s' - " - "value too old (%"PRIscTIME" < %"PRIscTIME")", + "value too old (%"PRIsdbTIME" < %"PRIsdbTIME")", SDB_STORE_TYPE_TO_NAME(type), name, last_update, old->last_update); /* don't report an error; the object may be updated by multiple diff --git a/src/core/time.c b/src/core/time.c index fe57384..762ffd0 100644 --- a/src/core/time.c +++ b/src/core/time.c @@ -115,16 +115,16 @@ sdb_strfinterval(char *s, size_t len, sdb_time_t interval) #define LEN (len > n ? len - n : 0) for (i = 0; i < SDB_STATIC_ARRAY_LEN(specs); ++i) { if (interval >= specs[i].interval) { - n += snprintf(s + n, LEN, "%"PRIscTIME"%s", + n += snprintf(s + n, LEN, "%"PRIsdbTIME"%s", interval / specs[i].interval, specs[i].suffix); interval %= specs[i].interval; - if (i == SDB_STATIC_ARRAY_LEN(specs) - 1) + if (specs[i].interval == SDB_INTERVAL_SECOND) have_seconds = 1; } } if (interval) { - n += snprintf(s + n, LEN, ".%09"PRIscTIME, interval); + n += snprintf(s + n, LEN, ".%09"PRIsdbTIME, interval); have_seconds = 1; /* removing trailing zeroes */ diff --git a/src/include/core/time.h b/src/include/core/time.h index f1a1dd5..7515af3 100644 --- a/src/include/core/time.h +++ b/src/include/core/time.h @@ -41,7 +41,7 @@ extern "C" { * The time, in nano-seconds, since the epoch. */ typedef uint64_t sdb_time_t; -#define PRIscTIME PRIu64 +#define PRIsdbTIME PRIu64 #define SECS_TO_SDB_TIME(s) ((sdb_time_t)(s) * (sdb_time_t)1000000000) #define SDB_TIME_TO_SECS(t) ((t) / (sdb_time_t)1000000000) diff --git a/t/unit/core/store_test.c b/t/unit/core/store_test.c index e5383b4..44e9c96 100644 --- a/t/unit/core/store_test.c +++ b/t/unit/core/store_test.c @@ -517,7 +517,7 @@ START_TEST(test_interval) fail_unless(host->interval == 10, "sdb_store_host() did not calculate interval correctly: " - "got: %"PRIscTIME"; expected: %"PRIscTIME, host->interval, 10); + "got: %"PRIsdbTIME"; expected: %"PRIsdbTIME, host->interval, 10); /* multiple updates for the same timestamp don't modify the interval */ sdb_store_host("host", 40); @@ -527,8 +527,8 @@ START_TEST(test_interval) fail_unless(host->interval == 10, "sdb_store_host() changed interval when doing multiple updates " - "using the same timestamp; got: %"PRIscTIME"; " - "expected: %"PRIscTIME, host->interval, 10); + "using the same timestamp; got: %"PRIsdbTIME"; " + "expected: %"PRIsdbTIME, host->interval, 10); /* multiple updates using an timestamp don't modify the interval */ sdb_store_host("host", 20); @@ -538,20 +538,20 @@ START_TEST(test_interval) fail_unless(host->interval == 10, "sdb_store_host() changed interval when doing multiple updates " - "using an old timestamp; got: %"PRIscTIME"; expected: %"PRIscTIME, + "using an old timestamp; got: %"PRIsdbTIME"; expected: %"PRIsdbTIME, host->interval, 10); /* new interval: 20 us */ sdb_store_host("host", 60); fail_unless(host->interval == 11, "sdb_store_host() did not calculate interval correctly: " - "got: %"PRIscTIME"; expected: %"PRIscTIME, host->interval, 11); + "got: %"PRIsdbTIME"; expected: %"PRIsdbTIME, host->interval, 11); /* new interval: 40 us */ sdb_store_host("host", 100); fail_unless(host->interval == 13, "sdb_store_host() did not calculate interval correctly: " - "got: %"PRIscTIME"; expected: %"PRIscTIME, host->interval, 11); + "got: %"PRIsdbTIME"; expected: %"PRIsdbTIME, host->interval, 11); sdb_object_deref(SDB_OBJ(host)); } diff --git a/t/unit/core/time_test.c b/t/unit/core/time_test.c index 2bffbbd..f1f4c94 100644 --- a/t/unit/core/time_test.c +++ b/t/unit/core/time_test.c @@ -68,14 +68,14 @@ START_TEST(test_strfinterval) for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { check = sdb_strfinterval(buf, sizeof(buf), golden_data[i].interval); fail_unless(check > 0, - "sdb_strfinterval(, , %"PRIscTIME") = %zu; " + "sdb_strfinterval(, , %"PRIsdbTIME") = %zu; " "expected: >0", golden_data[i].interval, check); fail_unless(!strcmp(buf, golden_data[i].expected), - "sdb_strfinterval(, , %"PRIscTIME") did not " + "sdb_strfinterval(, , %"PRIsdbTIME") did not " "format interval correctly; got: '%s'; expected: '%s'", golden_data[i].interval, buf, golden_data[i].expected); fail_unless(check == strlen(golden_data[i].expected), - "sdb_strfinterval(, , %"PRIscTIME") = %zu; " + "sdb_strfinterval(, , %"PRIsdbTIME") = %zu; " "expected: %zu", golden_data[i].interval, check, strlen(golden_data[i].expected)); } diff --git a/t/unit/utils/dbi_test.c b/t/unit/utils/dbi_test.c index 2935940..a1ac30a 100644 --- a/t/unit/utils/dbi_test.c +++ b/t/unit/utils/dbi_test.c @@ -558,8 +558,8 @@ query_callback(sdb_dbi_client_t *c, case SDB_TYPE_DATETIME: fail_unless(data[i].data.datetime == SECS_TO_SDB_TIME(expected_data.datetime), - "query callback received unexpected data "PRIscTIME - " for column %zu; expected: "PRIscTIME, + "query callback received unexpected data "PRIsdbTIME + " for column %zu; expected: "PRIsdbTIME, data[i].data.integer, i, SECS_TO_SDB_TIME(expected_data.integer)); break; -- 2.30.2