chiark / gitweb /
strv: add strv_print
[elogind.git] / src / timedate / timedatectl.c
index c96377f829d0e948b3af733621ddf688e318dac3..f5b5f0ca84e9accc702b1a4f8e4164de42ee8bd2 100644 (file)
@@ -124,12 +124,12 @@ static void print_status_info(StatusInfo *i) {
         sec = (time_t) (n / USEC_PER_SEC);
 
         zero(tm);
-        assert_se(strftime(a, sizeof(a), "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec, &tm)) > 0);
+        assert_se(strftime(a, sizeof(a), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec, &tm)) > 0);
         char_array_0(a);
         printf("      Local time: %s\n", a);
 
         zero(tm);
-        assert_se(strftime(a, sizeof(a), "%a, %Y-%m-%d %H:%M:%S UTC", gmtime_r(&sec, &tm)) > 0);
+        assert_se(strftime(a, sizeof(a), "%a %Y-%m-%d %H:%M:%S UTC", gmtime_r(&sec, &tm)) > 0);
         char_array_0(a);
         printf("  Universal time: %s\n", a);
 
@@ -139,16 +139,15 @@ static void print_status_info(StatusInfo *i) {
                 /* Calculcate the week-day */
                 mktime(&tm);
 
-                assert_se(strftime(a, sizeof(a), "%a, %Y-%m-%d %H:%M:%S", &tm) > 0);
+                assert_se(strftime(a, sizeof(a), "%a %Y-%m-%d %H:%M:%S", &tm) > 0);
                 char_array_0(a);
                 printf("        RTC time: %s\n", a);
         }
 
         zero(tm);
-        assert_se(strftime(a, sizeof(a), "%z", localtime_r(&sec, &tm)) > 0);
+        assert_se(strftime(a, sizeof(a), "%Z, %z", localtime_r(&sec, &tm)) > 0);
         char_array_0(a);
-        printf("        Timezone: %s\n"
-               "      UTC offset: %s\n"
+        printf("        Timezone: %s (%s)\n"
                "     NTP enabled: %s\n"
                "NTP synchronized: %s\n"
                " RTC in local TZ: %s\n",
@@ -168,30 +167,29 @@ static void print_status_info(StatusInfo *i) {
 
                 t = tc - 1;
                 zero(tm);
-                assert_se(strftime(a, sizeof(a), "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&t, &tm)) > 0);
+                assert_se(strftime(a, sizeof(a), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&t, &tm)) > 0);
                 char_array_0(a);
 
                 zero(tm);
-                assert_se(strftime(b, sizeof(b), "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&tc, &tm)) > 0);
+                assert_se(strftime(b, sizeof(b), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&tc, &tm)) > 0);
                 char_array_0(b);
-                printf(" Last DST change: %s → %s, DST became %s\n"
+                printf(" Last DST change: DST %s at\n"
                        "                  %s\n"
                        "                  %s\n",
-                       strna(zn), strna(zc), is_dstc ? "active" : "inactive", a, b);
+                       is_dstc ? "began" : "ended", a, b);
 
                 t = tn - 1;
                 zero(tm);
-                assert_se(strftime(a, sizeof(a), "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&t, &tm)) > 0);
+                assert_se(strftime(a, sizeof(a), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&t, &tm)) > 0);
                 char_array_0(a);
 
                 zero(tm);
-                assert_se(strftime(b, sizeof(b), "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&tn, &tm)) > 0);
+                assert_se(strftime(b, sizeof(b), "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&tn, &tm)) > 0);
                 char_array_0(b);
-                printf(" Next DST change: %s → %s, DST will become %s\n"
-                       "                  the clock will jump %s\n"
+                printf(" Next DST change: DST %s (the clock jumps %s) at\n"
                        "                  %s\n"
                        "                  %s\n",
-                       strna(zc), strna(zn), is_dstn ? "active" : "inactive", jump_str(dn, s, sizeof(s)), a, b);
+                       is_dstn ? "begins" : "ends", jump_str(dn, s, sizeof(s)), a, b);
 
                 free(zc);
                 free(zn);
@@ -427,7 +425,6 @@ static int list_timezones(DBusConnection *bus, char **args, unsigned n) {
         _cleanup_fclose_ FILE *f = NULL;
         _cleanup_strv_free_ char **zones = NULL;
         size_t n_zones = 0;
-        char **i;
 
         assert(args);
         assert(n == 1);
@@ -489,8 +486,7 @@ static int list_timezones(DBusConnection *bus, char **args, unsigned n) {
         pager_open_if_enabled();
 
         strv_sort(zones);
-        STRV_FOREACH(i, zones)
-                puts(*i);
+        strv_print(zones);
 
         return 0;
 }
@@ -553,7 +549,6 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case ARG_VERSION:
                         puts(PACKAGE_STRING);
-                        puts(DISTRIBUTION);
                         puts(SYSTEMD_FEATURES);
                         return 0;