- strna(i->timezone),
- a,
- yes_no(i->ntp),
- yes_no(ntp_synced()),
- yes_no(i->local_rtc));
-
- r = time_get_dst(sec, "/etc/localtime",
- &tc, &zc, &is_dstc,
- &tn, &zn, &is_dstn);
- if (r < 0)
- printf(" DST active: n/a\n");
- else {
- printf(" DST active: %s\n", yes_no(is_dstc));
-
- t = tc - 1;
- zero(tm);
- 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);
- char_array_0(b);
- printf(" Last DST change: %s → %s, one hour %s\n"
- " %s\n"
- " %s\n",
- strna(zn), strna(zc), is_dstc ? "forward" : "backwards", 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);
- 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);
- char_array_0(b);
- printf(" Next DST change: %s → %s, one hour %s\n"
- " %s\n"
- " %s\n",
- strna(zc), strna(zn), is_dstn ? "forward" : "backwards", a, b);
-
- free(zc);
- free(zn);
- }
+ 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));