diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-13 16:54:30 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-12-13 16:54:40 +0100 |
commit | bd9b253540ae283af8f1e6651a7b2a095b1533d4 (patch) | |
tree | 24cdcf08684770db8eac4746fbb58c58989aafaf /src/tests | |
parent | 13741aa952b57b6cfa60df42ed63a51b2fd59f06 (diff) | |
download | NetworkManager-bd9b253540ae283af8f1e6651a7b2a095b1533d4.tar.gz |
all: rename time related function to spell out nsec/usec/msec/sec
The abbreviations "ns" and "ms" seem not very clear to me. Spell them
out to nsec/msec. Also, in parts we already used the longer abbreviations,
so it wasn't consistent.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test-core-with-expect.c | 16 | ||||
-rw-r--r-- | src/tests/test-systemd.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/tests/test-core-with-expect.c b/src/tests/test-core-with-expect.c index 74e1043b33..555b962473 100644 --- a/src/tests/test-core-with-expect.c +++ b/src/tests/test-core-with-expect.c @@ -20,7 +20,7 @@ static void test_nm_utils_monotonic_timestamp_as_boottime (void) { - gint64 timestamp_ns_per_tick, now, now_boottime, now_boottime_2, now_boottime_3; + gint64 timestamp_nsec_per_tick, now, now_boottime, now_boottime_2, now_boottime_3; struct timespec tp; clockid_t clockid; guint i; @@ -35,22 +35,22 @@ test_nm_utils_monotonic_timestamp_as_boottime (void) if (clock_gettime (clockid, &tp) != 0) g_assert_not_reached (); - now_boottime = ( ((gint64) tp.tv_sec) * NM_UTILS_NS_PER_SECOND ) + ((gint64) tp.tv_nsec); + now_boottime = ( ((gint64) tp.tv_sec) * NM_UTILS_NSEC_PER_SEC ) + ((gint64) tp.tv_nsec); - now = nm_utils_get_monotonic_timestamp_ns (); + now = nm_utils_get_monotonic_timestamp_nsec (); now_boottime_2 = nm_utils_monotonic_timestamp_as_boottime (now, 1); g_assert_cmpint (now_boottime_2, >=, 0); g_assert_cmpint (now_boottime_2, >=, now_boottime); - g_assert_cmpint (now_boottime_2 - now_boottime, <=, NM_UTILS_NS_PER_SECOND / 10); + g_assert_cmpint (now_boottime_2 - now_boottime, <=, NM_UTILS_NSEC_PER_SEC / 10); g_assert_cmpint (now, ==, nm_utils_monotonic_timestamp_from_boottime (now_boottime_2, 1)); - for (timestamp_ns_per_tick = 1; timestamp_ns_per_tick <= NM_UTILS_NS_PER_SECOND; timestamp_ns_per_tick *= 10) { - now_boottime_3 = nm_utils_monotonic_timestamp_as_boottime (now / timestamp_ns_per_tick, timestamp_ns_per_tick); + for (timestamp_nsec_per_tick = 1; timestamp_nsec_per_tick <= NM_UTILS_NSEC_PER_SEC; timestamp_nsec_per_tick *= 10) { + now_boottime_3 = nm_utils_monotonic_timestamp_as_boottime (now / timestamp_nsec_per_tick, timestamp_nsec_per_tick); - g_assert_cmpint (now_boottime_2 / timestamp_ns_per_tick, ==, now_boottime_3); - g_assert_cmpint (now / timestamp_ns_per_tick, ==, nm_utils_monotonic_timestamp_from_boottime (now_boottime_3, timestamp_ns_per_tick)); + g_assert_cmpint (now_boottime_2 / timestamp_nsec_per_tick, ==, now_boottime_3); + g_assert_cmpint (now / timestamp_nsec_per_tick, ==, nm_utils_monotonic_timestamp_from_boottime (now_boottime_3, timestamp_nsec_per_tick)); } } } diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c index faed0e567b..6425c29488 100644 --- a/src/tests/test-systemd.c +++ b/src/tests/test-systemd.c @@ -27,7 +27,7 @@ _nm_utils_set_testing (NMUtilsTestFlags flags) } gint32 -nm_utils_get_monotonic_timestamp_s (void) +nm_utils_get_monotonic_timestamp_sec (void) { return 1; } |