Skip to content

Instantly share code, notes, and snippets.

@daurnimator
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daurnimator/091f687b58d2804a9c39 to your computer and use it in GitHub Desktop.
Save daurnimator/091f687b58d2804a9c39 to your computer and use it in GitHub Desktop.
Demostration of seek_tail issue.
CUTOFF = 1413177397982789
TAIL = 0
NEXT = 1
FOUND from 1400437372012374
NEXT = 1
FOUND from 1400438753925868
NEXT = 1
FOUND from 1400438753926192
NEXT = 1
FOUND from 1400438753926257
NEXT = 1
FOUND from 1400438753926289
NEXT = 1
FOUND from 1400438753926309
NEXT = 1
FOUND from 1400438753926330
NEXT = 1
FOUND from 1400438753926353
NEXT = 1
FOUND from 1400438753926373
NEXT = 1
FOUND from 1400438753926395
#include <stdio.h>
#include <assert.h>
#include "systemd/sd-journal.h"
int main() {
sd_journal* j;
assert(sd_journal_open(&j, 0)==0);
uint64_t from, to;
assert(sd_journal_get_cutoff_realtime_usec(j, &from, &to)==1);
printf("CUTOFF = %llu\n", to);
printf("TAIL = %d\n", sd_journal_seek_tail(j));
for (int i=0; i<10; i++) {
printf("NEXT = %lld\n", sd_journal_next(j));
assert(sd_journal_get_realtime_usec(j, &from)==0);
printf("FOUND from %llu\n", from);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment