From 2db20adc3ef2e3064a7621d14e94951778c75522 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 26 Sep 2014 15:47:57 +0200 Subject: [PATCH] client: print full date in manual list --- client.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/client.c b/client.c index 1c7a247..73cdf6e 100644 --- a/client.c +++ b/client.c @@ -67,30 +67,6 @@ static int no_dns = 0; static int recv_errqueue = 0; -/* ================================================== */ -/* Ought to extract some code from util.c to make - a new set of utilities that can be linked into either - the daemon or the client. */ - -static char * -time_to_log_form(time_t t) -{ - struct tm stm; - static char buffer[64]; - static const char *months[] = {"Jan", "Feb", "Mar", "Apr", - "May", "Jun", "Jul", "Aug", - "Sep", "Oct", "Nov", "Dec"}; - - - stm = *gmtime(&t); - snprintf(buffer, sizeof(buffer), - "%2d%s%02d %02d:%02d:%02d", - stm.tm_mday, months[stm.tm_mon], stm.tm_year % 100, - stm.tm_hour, stm.tm_min, stm.tm_sec); - - return buffer; -} - /* ================================================== */ /* Read a single line of commands from standard input. Eventually we might want to use the GNU readline library. */ @@ -2154,15 +2130,15 @@ process_cmd_manual_list(const char *line) if (request_reply(&request, &reply, RPY_MANUAL_LIST, 0)) { n_samples = ntohl(reply.data.manual_list.n_samples); printf("210 n_samples = %d\n", n_samples); - printf("# Date Time(UTC) Slewed Original Residual\n" - "====================================================\n"); + printf("# Date Time(UTC) Slewed Original Residual\n" + "=======================================================\n"); for (i=0; iwhen, &when); slewed_offset = UTI_FloatNetworkToHost(sample->slewed_offset); orig_offset = UTI_FloatNetworkToHost(sample->orig_offset); residual = UTI_FloatNetworkToHost(sample->residual); - printf("%2d %s %10.2f %10.2f %10.2f\n", i, time_to_log_form(when.tv_sec), slewed_offset, orig_offset, residual); + printf("%2d %s %10.2f %10.2f %10.2f\n", i, UTI_TimeToLogForm(when.tv_sec), slewed_offset, orig_offset, residual); } return 1; }