diff options
Diffstat (limited to 'src/binlogcat.c')
-rw-r--r-- | src/binlogcat.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/binlogcat.c b/src/binlogcat.c index c51125b..219f78c 100644 --- a/src/binlogcat.c +++ b/src/binlogcat.c @@ -30,2 +30,3 @@ int number_option; int verbose_option; +int timediff_option; @@ -39,3 +40,4 @@ catlog(const char *fname) size_t i; - + time_t start_ts; + if (strcmp(fname, "-") == 0) @@ -85,2 +87,8 @@ catlog(const char *fname) + if (timediff_option) { + if (i == 0) + start_ts = rec.ts; + rec.ts -= start_ts; + } + strftime(timebuf, sizeof timebuf, timefmt, localtime(&rec.ts)); @@ -97,3 +105,3 @@ help() { - printf("usage: %s [-hnv] [t FORMAT] [FILE...]\n"); + printf("usage: %s [-dhnv] [t FORMAT] [FILE...]\n"); } @@ -106,4 +114,8 @@ main(int argc, char **argv) - while ((c = getopt(argc, argv, "ht:nv")) != EOF) + while ((c = getopt(argc, argv, "dht:nv")) != EOF) switch (c) { + case 'd': + timediff_option = 1; + timefmt = "%s"; + break; case 'h': |