- strna(i->timezone),
- yes_no(i->ntp),
- yes_no(ntp_synced()),
- yes_no(i->local_rtc));
-
- if (i->local_rtc)
- fputs("\n" ANSI_HIGHLIGHT_ON
- "Warning: The RTC is configured to maintain time in the local time zone. This\n"
- " mode is not fully supported and will create various problems with time\n"
- " zone changes and daylight saving adjustments. If at all possible use\n"
- " RTC in UTC, by calling 'timedatectl set-local-rtc 0'" ANSI_HIGHLIGHT_OFF ".\n", stdout);
-}
-
-static int status_property(const char *name, DBusMessageIter *iter, StatusInfo *i) {
- assert(name);
- assert(iter);
-
- switch (dbus_message_iter_get_arg_type(iter)) {
-
- case DBUS_TYPE_STRING: {
- const char *s;
-
- dbus_message_iter_get_basic(iter, &s);
- if (!isempty(s)) {
- if (streq(name, "Timezone"))
- i->timezone = s;
+ strna(i->timezone), (int) sizeof(a), have_time ? a : "n/a",
+ i->ntp_capable ? yes_no(i->ntp_enabled) : "n/a",
+ yes_no(i->ntp_synced),
+ yes_no(i->rtc_local));
+
+ if (have_time) {
+ r = time_get_dst(sec, "/etc/localtime",
+ &tc, &zc, &is_dstc,
+ &tn, &dn, &zn, &is_dstn);
+ if (r < 0)
+ printf(" DST active: %s\n", "n/a");
+ else {
+ printf(" DST active: %s\n", yes_no(is_dstc));
+
+ t = tc - 1;
+ xstrftime(a, "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&t, &tm));
+
+ xstrftime(b, "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&tc, &tm));
+ printf(" Last DST change: DST %s at\n"
+ " %.*s\n"
+ " %.*s\n",
+ is_dstc ? "began" : "ended",
+ (int) sizeof(a), a,
+ (int) sizeof(b), b);
+
+ t = tn - 1;
+ xstrftime(a, "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&t, &tm));
+ xstrftime(b, "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&tn, &tm));
+ printf(" Next DST change: DST %s (the clock jumps %s) at\n"
+ " %.*s\n"
+ " %.*s\n",
+ is_dstn ? "begins" : "ends",
+ jump_str(dn, s, sizeof(s)),
+ (int) sizeof(a), a,
+ (int) sizeof(b), b);