The contents of environment variable S_TIME_FORMAT was not taken into
account when displaying a RESTART or a COMMENT message if this message
was the first line displayed in the report by sar:
$ sar
Linux 4.17.11-200.fc28.x86_64 (xxx) 08/25/2018 _x86_64_ (8 CPU)
14:10:50 LINUX RESTART (8 CPU)
02:15:47 PM CPU %user %nice %system %iowait %steal %idle
02:20:00 PM all 6.27 0.00 2.17 3.85 0.00 87.71
...
This patch fixes the problem by testing the environment variable sooner.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
return 0;
}
- if (!is_iso_time_fmt())
- flags |= S_F_PREFD_TIME_OUTPUT;
-
/* Get then set previous timestamp */
if (sa_get_record_timestamp_struct(flags + S_F_LOCAL_TIME, &record_hdr[!curr],
&rectime, NULL))
/* Default is CPU activity... */
select_default_activity(act);
+ /* Check S_TIME_FORMAT variable contents */
+ if (!is_iso_time_fmt())
+ flags |= S_F_PREFD_TIME_OUTPUT;
+
/* Reading stats from file: */
if (from_file[0]) {
if (interval < 0) {