diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-18 00:22:22 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-18 00:22:22 +0200 |
commit | 422c759f3f734cdf7f6d7368da5938b2b17abfe1 (patch) | |
tree | c7e8291f3a2f3610f7e1a6617599ae6496532406 /src | |
parent | 470e72d4081c7d0fd74666b7a45358d5ee2abee1 (diff) | |
parent | 44cf96e33e83bc9fadad552bda3962e5305e5c2b (diff) |
Merge pull request #277 from poettering/journal-interleaving-monotonic
journal: make sure the clock increases strict monotonic
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/test-journal-interleaving.c | 9 |
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); |