aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/ChangeLog4
-rw-r--r--tools/watchgnupg.c21
2 files changed, 20 insertions, 5 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog
index aad09355e..f841ac13a 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-06 Werner Koch <[email protected]>
+
+ * watchgnupg.c (print_version): Add option --time-only.
+
2010-10-05 Werner Koch <[email protected]>
* watchgnupg.c (main): Support TCP and local socket listening.
diff --git a/tools/watchgnupg.c b/tools/watchgnupg.c
index 95726dae9..958605c62 100644
--- a/tools/watchgnupg.c
+++ b/tools/watchgnupg.c
@@ -52,7 +52,7 @@
static int verbose;
-
+static int time_only;
static void
die (const char *format, ...)
@@ -136,10 +136,15 @@ print_fd_and_time (int fd)
time_t atime = time (NULL);
tp = localtime (&atime);
- printf ("%3d - %04d-%02d-%02d %02d:%02d:%02d ",
- fd,
- 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
- tp->tm_hour, tp->tm_min, tp->tm_sec );
+ if (time_only)
+ printf ("%3d - %02d:%02d:%02d ",
+ fd,
+ tp->tm_hour, tp->tm_min, tp->tm_sec );
+ else
+ printf ("%3d - %04d-%02d-%02d %02d:%02d:%02d ",
+ fd,
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec );
}
@@ -262,6 +267,7 @@ print_version (int with_help)
" --tcp listen on a TCP port and optionally on a local socket\n"
" --force delete an already existing socket file\n"
" --verbose enable extra informational output\n"
+ " --time-only print only the time; not a full timestamp\n"
" --version print version of the program and exit\n"
" --help display this help and exit\n"
BUGREPORT_LINE, stdout );
@@ -306,6 +312,11 @@ main (int argc, char **argv)
verbose = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--time-only"))
+ {
+ time_only = 1;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--force"))
{
force = 1;