aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-10-11 14:04:32 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2013-10-11 14:38:21 +0300
commit791cdf412f5fb66a056aa28b27507fdc9af86507 (patch)
tree9e6c4af696424ea72b51d0b8d9c8cf85c8b43856 /src
parentdf83b714395d41b096f7ad8cc3a090c9341f7598 (diff)
downloadvmod-binlog-791cdf412f5fb66a056aa28b27507fdc9af86507.tar.gz
vmod-binlog-791cdf412f5fb66a056aa28b27507fdc9af86507.tar.bz2
Add testsuite.
Diffstat (limited to 'src')
-rw-r--r--src/binlog.c2
-rw-r--r--src/binlogcat.c18
2 files changed, 16 insertions, 4 deletions
diff --git a/src/binlog.c b/src/binlog.c
index f896803..be32e10 100644
--- a/src/binlog.c
+++ b/src/binlog.c
@@ -454,3 +454,3 @@ vmod_append(struct sess *sp, struct vmod_priv *priv, int nid, int aid)
ts = time(NULL);
-
+
if (ts >= conf->stoptime) {
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':

Return to:

Send suggestions and report system problems to the System administrator.