summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 54a8eac)
raw | patch | inline | side by side (parent: 54a8eac)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 30 Jul 2014 07:30:35 +0000 (09:30 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 30 Jul 2014 07:30:35 +0000 (09:30 +0200) |
Another remnant of the “syscollector” days ;-)
index b8bbbfe63c29fb638f5ceb5ede65f73b83126751..07da8c022fb55393a253bf8a89c2c68dfc154f0d 100644 (file)
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 */
index 6481807637fb9bfba7ffeb5d584a19b083cf7410..0f94ce34fd2ebe2fc550d872ad595bc69028093b 100644 (file)
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 */
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 */
index ebe5dbd6468821d929a43d31d5e53178069063af..5efc531337c6fd80ab331879397a9a3923e127f7 100644 (file)
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 cc0927e3376a354278abddbcfbd6e064c48c83a3..ee861d33eedafbbce9906b183bf06df3ffc11cfa 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
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 fe57384a2aac81572021925b3c09e0eda75c9167..762ffd0034fc3315c77e3951c0a41f5566fa2a3b 100644 (file)
--- a/src/core/time.c
+++ b/src/core/time.c
#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 */
index f1a1dd5f9e17add0c03ef2f4fd9ca1f151d5330c..7515af3244720513a8b32d5628b718866a2d4d2b 100644 (file)
--- a/src/include/core/time.h
+++ b/src/include/core/time.h
* 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)
index e5383b43c60599c5d5ff8d9316f510081a7802ad..44e9c96c0bd4ad9aea2aa0232c086e028cbc3492 100644 (file)
--- a/t/unit/core/store_test.c
+++ b/t/unit/core/store_test.c
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);
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);
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));
}
index 2bffbbd5915a7ff1a5b1129068ab9e82ab85a1eb..f1f4c94663018b0305f364e333e3fd07d8141fd0 100644 (file)
--- a/t/unit/core/time_test.c
+++ b/t/unit/core/time_test.c
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(<buf>, <size>, %"PRIscTIME") = %zu; "
+ "sdb_strfinterval(<buf>, <size>, %"PRIsdbTIME") = %zu; "
"expected: >0", golden_data[i].interval, check);
fail_unless(!strcmp(buf, golden_data[i].expected),
- "sdb_strfinterval(<buf>, <size>, %"PRIscTIME") did not "
+ "sdb_strfinterval(<buf>, <size>, %"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(<buf>, <size>, %"PRIscTIME") = %zu; "
+ "sdb_strfinterval(<buf>, <size>, %"PRIsdbTIME") = %zu; "
"expected: %zu", golden_data[i].interval, check,
strlen(golden_data[i].expected));
}
index 2935940182f268bd36b68291e68bf30b8b8c6256..a1ac30a37983afa98c60228ed846ad567bb13e6d 100644 (file)
--- a/t/unit/utils/dbi_test.c
+++ b/t/unit/utils/dbi_test.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;