chiark / gitweb /
timedatectl: show "DST active: n/a" if no DST data is available
authorKay Sievers <kay@vrfy.org>
Fri, 2 Nov 2012 15:45:02 +0000 (05:45 -1000)
committerKay Sievers <kay@vrfy.org>
Fri, 2 Nov 2012 15:45:02 +0000 (05:45 -1000)
src/shared/time-dst.c
src/timedate/timedatectl.c

index 8f3cafd5eb8064c62b33ad556decb2923f211c4f..df5f15151d063bbb6c317c324a13a99194f4e51b 100644 (file)
@@ -102,7 +102,7 @@ int time_get_dst(time_t date, const char *tzfile,
         size_t tzspec_len;
         size_t num_leaps;
         size_t lo, hi;
-        int err = 0;
+        int err = -EINVAL;
 
         f = fopen(tzfile, "re");
         if (f == NULL)
index b7f2422a16ee2172318e2a70b28ebe578dc4d689..564f9e5f74eddd77712f0398556dfe83351cb5e2 100644 (file)
@@ -136,7 +136,9 @@ static void print_status_info(StatusInfo *i) {
         r = time_get_dst(sec, "/etc/localtime",
                          &tc, &zc, &is_dstc,
                          &tn, &zn, &is_dstn);
-        if (r >= 0) {
+        if (r < 0)
+                printf("      DST active: n/a\n");
+        else {
                 printf("      DST active: %s\n", yes_no(is_dstc));
 
                 t = tc - 1;