From: Matthias Wachs Date: Wed, 30 May 2012 08:54:23 +0000 (+0000) Subject: - adding timestamp for watch mode X-Git-Tag: initial-import-from-subversion-38251~13356 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eab4b6722aa4204502f193fb965d9a5193857354;p=oweals%2Fgnunet.git - adding timestamp for watch mode --- diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index c28514144..3eef887fc 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c @@ -27,6 +27,7 @@ #include "platform.h" #include "gnunet_getopt_lib.h" #include "gnunet_program_lib.h" +#include "gnunet_util_lib.h" #include "gnunet_statistics_service.h" #include "statistics.h" @@ -77,9 +78,26 @@ static int printer (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent) { + struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get(); + char * now_str; if (quiet == GNUNET_NO) - FPRINTF (stdout, "%s%-12s %-50s: %16llu\n", is_persistent ? "!" : " ", - subsystem, _(name), (unsigned long long) value); + { + if (GNUNET_YES == watch) + { + now_str = GNUNET_STRINGS_absolute_time_to_string(now); + FPRINTF (stdout, "%24s %s%12s %50s: %16llu \n", + now_str, + is_persistent ? "!" : " ", + subsystem, _(name), (unsigned long long) value); + GNUNET_free (now_str); + } + else + { + FPRINTF (stdout, "%s%12s %50s: %16llu \n", + is_persistent ? "!" : " ", + subsystem, _(name), (unsigned long long) value); + } + } else FPRINTF (stdout, "%llu\n", (unsigned long long) value);