summaryrefslogtreecommitdiff
path: root/src/journal/test-journal-interleaving.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-06-17 23:04:02 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-17 23:26:39 +0200
commit44cf96e33e83bc9fadad552bda3962e5305e5c2b (patch)
tree4af7fc12444fbc866e59e83a15023ce4abe0a7c8 /src/journal/test-journal-interleaving.c
parentde587378ea5d22e11373b18b4fcabf8f26f89529 (diff)
journal: make sure the clock increases strict monotonic
Let's work around crappy clocks in test-journal-interleaving.c too. This does the same as 98d2a5341788b49e82d628dfdc2e241af6d70dcd but for test-journal-interlaving.c rather than test-journal-stream.c.
Diffstat (limited to 'src/journal/test-journal-interleaving.c')
-rw-r--r--src/journal/test-journal-interleaving.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index c2fc123e42..adefa1b026 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -62,10 +62,19 @@ static void test_close(JournalFile *f) {
static void append_number(JournalFile *f, int n, uint64_t *seqnum) {
char *p;
dual_timestamp ts;
+ static dual_timestamp previous_ts = {};
struct iovec iovec[1];
dual_timestamp_get(&ts);
+ if (ts.monotonic <= previous_ts.monotonic)
+ ts.monotonic = previous_ts.monotonic + 1;
+
+ if (ts.realtime <= previous_ts.realtime)
+ ts.realtime = previous_ts.realtime + 1;
+
+ previous_ts = ts;
+
assert_se(asprintf(&p, "NUMBER=%d", n) >= 0);
iovec[0].iov_base = p;
iovec[0].iov_len = strlen(p);