]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
client: print full date in manual list
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 26 Sep 2014 13:47:57 +0000 (15:47 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 26 Sep 2014 13:47:57 +0000 (15:47 +0200)
client.c

index 1c7a2476f26b7a5716199a9268e4b02628662231..73cdf6e65cf187bf4cbd70a1ce62fc7a5b6541d3 100644 (file)
--- 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; i<n_samples; i++) {
             sample = &reply.data.manual_list.samples[i];
             UTI_TimevalNetworkToHost(&sample->when, &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;
   }