]> granicus.if.org Git - sysstat/commitdiff
sadf: Display timezone for all output formats
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 17 Sep 2022 10:18:06 +0000 (12:18 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 17 Sep 2022 10:18:06 +0000 (12:18 +0200)
The timezone is now displayed even in local time (-T) and in true time
mode (-t).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa.h
sa_common.c
sadf.c
sadf.h
sadf_misc.c
sar.c
svg_stats.c

diff --git a/sa.h b/sa.h
index 202abaaf9415f4d6717ae80fb7bc5eaa0869225b..14d82c49563ab90f28180182e55371223a20c3e9 100644 (file)
--- a/sa.h
+++ b/sa.h
@@ -369,6 +369,7 @@ struct svg_parm {
        char minute;                            /* locale of the datafile creator) for first */
        char second;                            /* sample */
        struct file_header *file_hdr;           /* Pointer on file header structure */
+       char my_tzname[TZNAME_LEN];             /* Current timezone */
 };
 
 /* Structure used when displaying SVG header */
@@ -1171,8 +1172,9 @@ struct report_format {
         * This function displays the report header
         * (data displayed once at the beginning of the report).
         */
-       __printf_funct_t (*f_header) (void *, int, char *, struct file_magic *, struct file_header *,
-                                     struct activity * [], unsigned int [], struct file_activity *);
+       __printf_funct_t (*f_header) (void *, int, char *, char *, struct file_magic *,
+                                     struct file_header *, struct activity * [], unsigned int [],
+                                     struct file_activity *);
        /*
         * This function defines the statistics part of the report.
         * Used only with textual (XML-like) reports and PCP archives.
@@ -1182,17 +1184,17 @@ struct report_format {
         * This function defines the timestamp part of the report.
         * Used only with textual (XML-like) reports, PCP archives and RAW output format.
         */
-       __tm_funct_t (*f_timestamp) (void *, int, char *, char *, unsigned long long,
+       __tm_funct_t (*f_timestamp) (void *, int, char *, char *, char *, unsigned long long,
                                     struct record_header *, struct file_header *, unsigned int);
        /*
         * This function displays the restart messages.
         */
-       __printf_funct_t (*f_restart) (int *, int, char *, char *,
+       __printf_funct_t (*f_restart) (int *, int, char *, char *, char *,
                                       struct file_header *, struct record_header *);
        /*
         * This function displays the comments.
         */
-       __printf_funct_t (*f_comment) (int *, int, char *, char *, char *,
+       __printf_funct_t (*f_comment) (int *, int, char *, char *, char *, char *,
                                       struct file_header *, struct record_header *);
        /*
         * This is the main function used to display all the statistics for current format.
@@ -1561,13 +1563,13 @@ int parse_timestamp
 void print_report_hdr
        (uint64_t, struct tm *, struct file_header *);
 void print_sar_comment
-       (int *, int, char *, char *, char *, struct file_header *,
+       (int *, int, char *, char *, char *, char *, struct file_header *,
         struct record_header *);
 __printf_funct_t print_sar_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 int print_special_record
        (struct record_header *, uint64_t, struct tstamp *, struct tstamp *,
-        int, int, struct tm *, char *, int, struct file_magic *,
+        int, int, struct tm *, char *, int, char *, struct file_magic *,
         struct file_header *, struct activity * [], struct report_format *, int, int);
 int read_file_stat_bunch
        (struct activity * [], int, int, int, struct file_activity *, int, int,
index cbac9155b0f9fabf3a3eb22dd0110c5c5f3b12ba..3699a840fdc8b224d1af215ede5b28dcde3ea875 100644 (file)
@@ -2943,6 +2943,7 @@ void set_record_timestamp_string(uint64_t l_flags, struct record_header *record_
  *             be saved for current record.
  * @file       Name of file being read.
  * @tab                Number of tabulations to print.
+ * @my_tz      Current timezone.
  * @file_magic file_magic structure filled with file magic header data.
  * @file_hdr   System activity file standard header.
  * @act                Array of activities.
@@ -2961,7 +2962,7 @@ void set_record_timestamp_string(uint64_t l_flags, struct record_header *record_
  */
 int print_special_record(struct record_header *record_hdr, uint64_t l_flags,
                         struct tstamp *tm_start, struct tstamp *tm_end, int rtype, int ifd,
-                        struct tm *rectime, char *file, int tab,
+                        struct tm *rectime, char *file, int tab, char *my_tz,
                         struct file_magic *file_magic, struct file_header *file_hdr,
                         struct activity *act[], struct report_format *ofmt,
                         int endian_mismatch, int arch_64)
@@ -3016,7 +3017,7 @@ int print_special_record(struct record_header *record_hdr, uint64_t l_flags,
                        return 0;
 
                if (*ofmt->f_restart) {
-                       (*ofmt->f_restart)(&tab, F_MAIN, cur_date, cur_time, file_hdr, record_hdr);
+                       (*ofmt->f_restart)(&tab, F_MAIN, cur_date, cur_time, my_tz, file_hdr, record_hdr);
                }
        }
        else if (rtype == R_COMMENT) {
@@ -3033,7 +3034,7 @@ int print_special_record(struct record_header *record_hdr, uint64_t l_flags,
                        return 0;
 
                if (*ofmt->f_comment) {
-                       (*ofmt->f_comment)(&tab, F_MAIN, cur_date, cur_time,
+                       (*ofmt->f_comment)(&tab, F_MAIN, cur_date, cur_time, my_tz,
                                           file_comment, file_hdr, record_hdr);
                }
        }
diff --git a/sadf.c b/sadf.c
index 192394e0023094db0689a573c84e21d55f7c78b2..dede7871e718a5ce945caccda412c1ca156006fc 100644 (file)
--- a/sadf.c
+++ b/sadf.c
@@ -54,6 +54,8 @@ extern int __env;
 void int_handler(int n) { return; }
 #endif
 
+extern char *tzname[2];
+
 long interval = -1, count = 0;
 
 /* TRUE if data read from file don't match current machine's endianness */
@@ -88,6 +90,9 @@ struct record_header record_hdr[3];
 struct tstamp tm_start, tm_end;
 char *args[MAX_ARGV_NR];
 
+/* Current timezone */
+char my_tzname[TZNAME_LEN];
+
 extern struct activity *act[];
 extern struct report_format *fmt[];
 
@@ -273,7 +278,7 @@ int read_next_sample(int ifd, int action, int curr, char *file, int *rtype, int
                else {
                        /* Display COMMENT record */
                        print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
-                                            *rtype, ifd, rectime, file, tab,
+                                            *rtype, ifd, rectime, file, tab, my_tzname,
                                             file_magic, &file_hdr, act, fmt[f_position],
                                             endian_mismatch, arch_64);
                }
@@ -301,7 +306,7 @@ int read_next_sample(int ifd, int action, int curr, char *file, int *rtype, int
                else {
                        /* Display RESTART record */
                        print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
-                                            *rtype, ifd, rectime, file, tab,
+                                            *rtype, ifd, rectime, file, tab, my_tzname,
                                             file_magic, &file_hdr, act, fmt[f_position],
                                             endian_mismatch, arch_64);
                }
@@ -710,8 +715,9 @@ int generic_write_stats(int curr, int use_tm_start, int use_tm_end, int reset,
                                    cur_date, cur_time, TIMESTAMP_LEN, rectime);
 
        if (*fmt[f_position]->f_timestamp) {
-               pre = (char *) (*fmt[f_position]->f_timestamp)(parm, F_BEGIN, cur_date, cur_time, dt,
-                                                              &record_hdr[curr], &file_hdr, flags);
+               pre = (char *) (*fmt[f_position]->f_timestamp)(parm, F_BEGIN, cur_date, cur_time,
+                                                              my_tzname, dt, &record_hdr[curr],
+                                                              &file_hdr, flags);
        }
 
        /* Display statistics */
@@ -731,7 +737,7 @@ int generic_write_stats(int curr, int use_tm_start, int use_tm_end, int reset,
                                if (IS_SELECTED(act[i]->options) && (act[i]->nr[curr] > 0)) {
 
                                        if (*fmt[f_position]->f_timestamp) {
-                                               (*fmt[f_position]->f_timestamp)(tab, F_MAIN, cur_date, cur_time,
+                                               (*fmt[f_position]->f_timestamp)(tab, F_MAIN, cur_date, cur_time, NULL,
                                                                                dt, &record_hdr[curr],
                                                                                &file_hdr, flags);
                                        }
@@ -785,7 +791,7 @@ int generic_write_stats(int curr, int use_tm_start, int use_tm_end, int reset,
        }
 
        if (*fmt[f_position]->f_timestamp) {
-               (*fmt[f_position]->f_timestamp)(parm, F_END, cur_date, cur_time, dt,
+               (*fmt[f_position]->f_timestamp)(parm, F_END, cur_date, cur_time, NULL, dt,
                                                &record_hdr[curr], &file_hdr, flags);
        }
 
@@ -930,6 +936,7 @@ void display_curr_act_graphs(int ifd, int *curr, long *cnt, int *eosaf,
        parm.hour = record_hdr[2].hour;
        parm.minute = record_hdr[2].minute;
        parm.second = record_hdr[2].second;
+       strcpy(parm.my_tzname, my_tzname);
 
        *cnt  = count;
        reset_cd = 1;
@@ -1040,7 +1047,7 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
 
        /* Print header (eg. XML file header) */
        if (*fmt[f_position]->f_header) {
-               (*fmt[f_position]->f_header)(&tab, F_BEGIN, pcparchive, file_magic,
+               (*fmt[f_position]->f_header)(&tab, F_BEGIN, pcparchive, my_tzname, file_magic,
                                             &file_hdr, act, id_seq, file_actlst);
        }
 
@@ -1049,10 +1056,11 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
 
                /* RESTART and COMMENTS records will be immediately processed */
                if (*fmt[f_position]->f_restart) {
-                       (*fmt[f_position]->f_restart)(&tab, F_BEGIN, NULL, NULL, &file_hdr, NULL);
+                       (*fmt[f_position]->f_restart)(&tab, F_BEGIN, NULL, NULL, NULL,
+                                                     &file_hdr, NULL);
                }
                if (DISPLAY_COMMENT(flags) && (*fmt[f_position]->f_comment)) {
-                       (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, NULL,
+                       (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, NULL, NULL,
                                                      &file_hdr, NULL);
                }
        }
@@ -1134,10 +1142,11 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
                 * Display possible trailing data then terminate.
                 */
                if (*fmt[f_position]->f_restart) {
-                       (*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, &file_hdr, NULL);
+                       (*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, NULL,
+                                                     &file_hdr, NULL);
                }
                if (DISPLAY_COMMENT(flags) && (*fmt[f_position]->f_comment)) {
-                       (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, NULL,
+                       (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, NULL, NULL,
                                                      &file_hdr, NULL);
                }
                goto terminate;
@@ -1148,7 +1157,7 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
 
        /* Process now RESTART entries to display restart messages */
        if (*fmt[f_position]->f_restart) {
-               (*fmt[f_position]->f_restart)(&tab, F_BEGIN, NULL, NULL, &file_hdr, NULL);
+               (*fmt[f_position]->f_restart)(&tab, F_BEGIN, NULL, NULL, NULL, &file_hdr, NULL);
        }
 
        do {
@@ -1159,7 +1168,7 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
        while (!eosaf);
 
        if (*fmt[f_position]->f_restart) {
-               (*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, &file_hdr, NULL);
+               (*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, NULL, &file_hdr, NULL);
        }
 
        /* Rewind file */
@@ -1168,7 +1177,7 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
        /* Last, process COMMENT entries to display comments */
        if (DISPLAY_COMMENT(flags)) {
                if (*fmt[f_position]->f_comment) {
-                       (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, NULL,
+                       (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, NULL, NULL,
                                                      &file_hdr, NULL);
                }
                do {
@@ -1179,7 +1188,7 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
                while (!eosaf);
 
                if (*fmt[f_position]->f_comment) {
-                       (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, NULL,
+                       (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, NULL, NULL,
                                                      &file_hdr, NULL);
                }
        }
@@ -1187,7 +1196,7 @@ void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
 terminate:
        /* Print header trailer */
        if (*fmt[f_position]->f_header) {
-               (*fmt[f_position]->f_header)(&tab, F_END, pcparchive, file_magic,
+               (*fmt[f_position]->f_header)(&tab, F_END, pcparchive, my_tzname, file_magic,
                                             &file_hdr, act, id_seq, file_actlst);
        }
 }
@@ -1317,7 +1326,7 @@ void logic2_display_loop(int ifd, char *file, struct file_activity *file_actlst,
                 */
                if (!eosaf && (record_hdr[curr].record_type == R_RESTART)) {
                        print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
-                                            R_RESTART, ifd, rectime, file, 0,
+                                            R_RESTART, ifd, rectime, file, 0, my_tzname,
                                             file_magic, &file_hdr, act, fmt[f_position],
                                             endian_mismatch, arch_64);
                }
@@ -1375,7 +1384,7 @@ void svg_display_loop(int ifd, char *file, struct file_activity *file_actlst,
 
        /* Print SVG header */
        if (*fmt[f_position]->f_header) {
-               (*fmt[f_position]->f_header)(&parm, F_BEGIN + F_MAIN, file, file_magic,
+               (*fmt[f_position]->f_header)(&parm, F_BEGIN + F_MAIN, file, NULL, file_magic,
                                             &file_hdr, act, id_seq, file_actlst);
        }
 
@@ -1443,7 +1452,7 @@ void svg_display_loop(int ifd, char *file, struct file_activity *file_actlst,
 close_svg:
        /* Print SVG trailer */
        if (*fmt[f_position]->f_header) {
-               (*fmt[f_position]->f_header)(&parm, F_END, file, file_magic,
+               (*fmt[f_position]->f_header)(&parm, F_END, file, NULL, file_magic,
                                             &file_hdr, act, id_seq, file_actlst);
        }
 }
@@ -1476,8 +1485,9 @@ void read_stats_from_file(char dfile[], char pcparchive[])
                                dfile = pcparchive;
                        }
                        /* Display only data file header then exit */
-                       (*fmt[f_position]->f_header)(&tab, F_BEGIN + F_END, dfile, &file_magic,
-                                                    &file_hdr, act, id_seq, file_actlst);
+                       (*fmt[f_position]->f_header)(&tab, F_BEGIN + F_END, dfile, my_tzname,
+                                                    &file_magic, &file_hdr, act, id_seq,
+                                                    file_actlst);
                }
                exit(0);
        }
@@ -1893,6 +1903,13 @@ int main(int argc, char **argv)
                usage(argv[0]);
        }
 
+       /* Get timezone */
+       if (PRINT_LOCAL_TIME(flags)) {
+               tzset();
+               strncpy(my_tzname, tzname[0], TZNAME_LEN);
+               my_tzname[TZNAME_LEN - 1] = '\0';
+       }
+
        /*
         * Display all the contents of the daily data file if the count parameter
         * was not set on the command line.
diff --git a/sadf.h b/sadf.h
index f46cadfc7a891c6a38c940ddae130a090f8d657e..0d1e6bd27ed1a2ffb2cf280a3d730cfb1bb085f3 100644 (file)
--- a/sadf.h
+++ b/sadf.h
@@ -114,33 +114,33 @@ void convert_file
  * Prototypes used to display restart messages
  */
 __printf_funct_t print_db_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_ppc_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_xml_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_json_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_raw_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_pcp_restart
-       (int *, int, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
 
 /*
  * Prototypes used to display comments
  */
 __printf_funct_t print_db_comment
-       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_ppc_comment
-       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_xml_comment
-       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_json_comment
-       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_raw_comment
-       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, char *, struct file_header *, struct record_header *);
 __printf_funct_t print_pcp_comment
-       (int *, int, char *, char *, char *, struct file_header *, struct record_header *);
+       (int *, int, char *, char *, char *, char *, struct file_header *, struct record_header *);
 
 /*
  * Prototypes used to display the statistics part of the report
@@ -156,41 +156,41 @@ __printf_funct_t print_pcp_statistics
  * Prototypes used to display the timestamp part of the report
  */
 __tm_funct_t print_db_timestamp
-       (void *, int, char *, char *, unsigned long long,
+       (void *, int, char *, char *, char *, unsigned long long,
         struct record_header *, struct file_header *, unsigned int);
 __tm_funct_t print_ppc_timestamp
-       (void *, int, char *, char *, unsigned long long,
+       (void *, int, char *, char *, char *, unsigned long long,
         struct record_header *, struct file_header *, unsigned int);
 __tm_funct_t print_xml_timestamp
-       (void *, int, char *, char *, unsigned long long,
+       (void *, int, char *, char *, char *, unsigned long long,
         struct record_header *, struct file_header *, unsigned int);
 __tm_funct_t print_json_timestamp
-       (void *, int, char *, char *, unsigned long long,
+       (void *, int, char *, char *, char *, unsigned long long,
         struct record_header *, struct file_header *, unsigned int);
 __tm_funct_t print_raw_timestamp
-       (void *, int, char *, char *, unsigned long long,
+       (void *, int, char *, char *, char *, unsigned long long,
         struct record_header *, struct file_header *, unsigned int);
 __tm_funct_t print_pcp_timestamp
-       (void *, int, char *, char *, unsigned long long,
+       (void *, int, char *, char *, char *, unsigned long long,
         struct record_header *, struct file_header *, unsigned int);
 
 /*
  * Prototypes used to display the report header
  */
 __printf_funct_t print_xml_header
-       (void *, int, char *, struct file_magic *, struct file_header *,
+       (void *, int, char *, char *, struct file_magic *, struct file_header *,
         struct activity * [], unsigned int [], struct file_activity *);
 __printf_funct_t print_json_header
-       (void *, int, char *, struct file_magic *, struct file_header *,
+       (void *, int, char *, char *, struct file_magic *, struct file_header *,
         struct activity * [], unsigned int [], struct file_activity *);
 __printf_funct_t print_hdr_header
-       (void *, int, char *, struct file_magic *, struct file_header *,
+       (void *, int, char *, char *, struct file_magic *, struct file_header *,
         struct activity * [], unsigned int [], struct file_activity *);
 __printf_funct_t print_svg_header
-       (void *, int, char *, struct file_magic *, struct file_header *,
+       (void *, int, char *, char *, struct file_magic *, struct file_header *,
         struct activity * [], unsigned int [], struct file_activity *);
 __printf_funct_t print_pcp_header
-       (void *, int, char *, struct file_magic *, struct file_header *,
+       (void *, int, char *, char *, struct file_magic *, struct file_header *,
         struct activity * [], unsigned int [], struct file_activity *);
 
 /*
index 5c22ddb14596f13b2f1db05e5433e6f75079aae6..86488f0b42d7e0cf106fdc046a3c68abe6938cd0 100644 (file)
@@ -100,11 +100,12 @@ void pcp_write_data(struct record_header *record_hdr, unsigned int flags)
  * IN:
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @sep                Character used as separator.
  * @file_hdr   System activity file standard header.
  ***************************************************************************
  */
-void print_dbppc_restart(char *cur_date, char *cur_time, char sep,
+void print_dbppc_restart(char *cur_date, char *cur_time, char *my_tz, char sep,
                         struct file_header *file_hdr)
 {
        printf("%s%c-1%c", file_hdr->sa_nodename, sep, sep);
@@ -112,8 +113,10 @@ void print_dbppc_restart(char *cur_date, char *cur_time, char sep,
                printf("%s ", cur_date);
        }
        printf("%s", cur_time);
-       if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) {
-               printf(" %s", PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC");
+       if (strlen(cur_date)) {
+               printf(" %s", PRINT_LOCAL_TIME(flags) ? my_tz
+                                                     : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                               : "UTC"));
        }
        printf("%cLINUX-RESTART\t(%d CPU)\n",
               sep, file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
@@ -128,17 +131,18 @@ void print_dbppc_restart(char *cur_date, char *cur_time, char sep,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
-__printf_funct_t print_db_restart(int *tab, int action, char *cur_date,
-                                 char *cur_time, struct file_header *file_hdr,
+__printf_funct_t print_db_restart(int *tab, int action, char *cur_date, char *cur_time,
+                                 char *my_tz, struct file_header *file_hdr,
                                  struct record_header *record_hdr)
 {
        /* Actions F_BEGIN and F_END ignored */
        if (action == F_MAIN) {
-               print_dbppc_restart(cur_date, cur_time, ';', file_hdr);
+               print_dbppc_restart(cur_date, cur_time, my_tz, ';', file_hdr);
        }
 }
 
@@ -151,17 +155,18 @@ __printf_funct_t print_db_restart(int *tab, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
-__printf_funct_t print_ppc_restart(int *tab, int action, char *cur_date,
-                                  char *cur_time, struct file_header *file_hdr,
+__printf_funct_t print_ppc_restart(int *tab, int action, char *cur_date, char *cur_time,
+                                  char *my_tz, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
        /* Actions F_BEGIN and F_END ignored */
        if (action == F_MAIN) {
-               print_dbppc_restart(cur_date, cur_time, '\t', file_hdr);
+               print_dbppc_restart(cur_date, cur_time, my_tz, '\t', file_hdr);
        }
 }
 
@@ -174,6 +179,7 @@ __printf_funct_t print_ppc_restart(int *tab, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone (unused here).
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  *
@@ -181,17 +187,19 @@ __printf_funct_t print_ppc_restart(int *tab, int action, char *cur_date,
  * @tab                Number of tabulations.
  ***************************************************************************
  */
-__printf_funct_t print_xml_restart(int *tab, int action, char *cur_date,
-                                  char *cur_time, struct file_header *file_hdr,
+__printf_funct_t print_xml_restart(int *tab, int action, char *cur_date, char *cur_time,
+                                  char *my_tz, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
        if (action & F_BEGIN) {
                xprintf((*tab)++, "<restarts>");
        }
        if (action & F_MAIN) {
-               xprintf(*tab, "<boot date=\"%s\" time=\"%s\" utc=\"%d\" cpu_count=\"%d\"/>",
+               xprintf(*tab, "<boot date=\"%s\" time=\"%s\" tz=\"%s\" cpu_count=\"%d\"/>",
                        cur_date, cur_time,
-                       !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0,
+                       PRINT_LOCAL_TIME(flags) ? my_tz
+                                               : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                         : "UTC"),
                        file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
        }
        if (action & F_END) {
@@ -208,6 +216,7 @@ __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone (unused here).
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  *
@@ -215,8 +224,8 @@ __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date,
  * @tab                Number of tabulations.
  ***************************************************************************
  */
-__printf_funct_t print_json_restart(int *tab, int action, char *cur_date,
-                                   char *cur_time, struct file_header *file_hdr,
+__printf_funct_t print_json_restart(int *tab, int action, char *cur_date, char *cur_time,
+                                   char *my_tz, struct file_header *file_hdr,
                                    struct record_header *record_hdr)
 {
        static int sep = FALSE;
@@ -230,9 +239,11 @@ __printf_funct_t print_json_restart(int *tab, int action, char *cur_date,
                        printf(",\n");
                }
                xprintf((*tab)++, "{");
-               xprintf(*tab, "\"boot\": {\"date\": \"%s\", \"time\": \"%s\", \"utc\": %d, \"cpu_count\": %d}",
+               xprintf(*tab, "\"boot\": {\"date\": \"%s\", \"time\": \"%s\", \"tz\": \"%s\", \"cpu_count\": %d}",
                        cur_date, cur_time,
-                       !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0,
+                       PRINT_LOCAL_TIME(flags) ? my_tz
+                                               : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                         : "UTC"),
                        file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
                xprintf0(--(*tab), "}");
                sep = TRUE;
@@ -255,19 +266,22 @@ __printf_funct_t print_json_restart(int *tab, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
-__printf_funct_t print_raw_restart(int *tab, int action, char *cur_date,
-                                  char *cur_time, struct file_header *file_hdr,
+__printf_funct_t print_raw_restart(int *tab, int action, char *cur_date, char *cur_time,
+                                  char *my_tz, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
        /* Actions F_BEGIN and F_END ignored */
        if (action == F_MAIN) {
                printf("%s", cur_time);
-               if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) {
-                       printf(" %s", PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC");
+               if (strlen(cur_date)) {
+                       printf(" %s", PRINT_LOCAL_TIME(flags) ? my_tz
+                                                             : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                                       : "UTC"));
                }
                printf("; LINUX-RESTART (%d CPU)\n",
                       file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
@@ -283,12 +297,13 @@ __printf_funct_t print_raw_restart(int *tab, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message (unused here).
  * @cur_time   Time string of current restart message (unused here).
+ * @my_tz      Current timezone (unused here).
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header.
  ***************************************************************************
  */
 __printf_funct_t print_pcp_restart(int *tab, int action, char *cur_date, char *cur_time,
-                                  struct file_header *file_hdr,
+                                  char *my_tz, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
 #ifdef HAVE_PCP
@@ -328,12 +343,13 @@ __printf_funct_t print_pcp_restart(int *tab, int action, char *cur_date, char *c
  * IN:
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @comment    Comment to display.
  * @sep                Character used as separator.
  * @file_hdr   System activity file standard header.
  ***************************************************************************
  */
-void print_dbppc_comment(char *cur_date, char *cur_time, char *comment,
+void print_dbppc_comment(char *cur_date, char *cur_time, char *my_tz, char *comment,
                         char sep, struct file_header *file_hdr)
 {
        printf("%s%c-1%c", file_hdr->sa_nodename, sep, sep);
@@ -341,8 +357,10 @@ void print_dbppc_comment(char *cur_date, char *cur_time, char *comment,
                printf("%s ", cur_date);
        }
        printf("%s", cur_time);
-       if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) {
-               printf(" %s", PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC");
+       if (strlen(cur_date)) {
+               printf(" %s", PRINT_LOCAL_TIME(flags) ? my_tz
+                                                     : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                               : "UTC"));
        }
        printf("%cCOM %s\n", sep, comment);
 }
@@ -356,18 +374,19 @@ void print_dbppc_comment(char *cur_date, char *cur_time, char *comment,
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
 __printf_funct_t print_db_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                 char *comment, struct file_header *file_hdr,
+                                 char *my_tz, char *comment, struct file_header *file_hdr,
                                  struct record_header *record_hdr)
 {
        /* Actions F_BEGIN and F_END ignored */
        if (action & F_MAIN) {
-               print_dbppc_comment(cur_date, cur_time, comment, ';', file_hdr);
+               print_dbppc_comment(cur_date, cur_time, my_tz, comment, ';', file_hdr);
        }
 }
 
@@ -380,18 +399,19 @@ __printf_funct_t print_db_comment(int *tab, int action, char *cur_date, char *cu
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
 __printf_funct_t print_ppc_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                  char *comment, struct file_header *file_hdr,
+                                  char *my_tz, char *comment, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
        /* Actions F_BEGIN and F_END ignored */
        if (action & F_MAIN) {
-               print_dbppc_comment(cur_date, cur_time, comment, '\t', file_hdr);
+               print_dbppc_comment(cur_date, cur_time, my_tz, comment, '\t', file_hdr);
        }
 }
 
@@ -404,6 +424,7 @@ __printf_funct_t print_ppc_comment(int *tab, int action, char *cur_date, char *c
  * @action     Action expected from current function.
  * @cur_date   Date string of current comment.
  * @cur_time   Time string of current comment.
+ * @my_tz      Current timezone.
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header (unused here).
  * @record_hdr Current record header (unused here).
@@ -413,16 +434,18 @@ __printf_funct_t print_ppc_comment(int *tab, int action, char *cur_date, char *c
  ***************************************************************************
  */
 __printf_funct_t print_xml_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                  char *comment, struct file_header *file_hdr,
+                                  char *my_tz, char *comment, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
        if (action & F_BEGIN) {
                xprintf((*tab)++, "<comments>");
        }
        if (action & F_MAIN) {
-               xprintf(*tab, "<comment date=\"%s\" time=\"%s\" utc=\"%d\" com=\"%s\"/>",
+               xprintf(*tab, "<comment date=\"%s\" time=\"%s\" tz=\"%s\" com=\"%s\"/>",
                        cur_date, cur_time,
-                       !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0,
+                       PRINT_LOCAL_TIME(flags) ? my_tz
+                                               : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                         : "UTC"),
                        comment);
        }
        if (action & F_END) {
@@ -439,6 +462,7 @@ __printf_funct_t print_xml_comment(int *tab, int action, char *cur_date, char *c
  * @action     Action expected from current function.
  * @cur_date   Date string of current comment.
  * @cur_time   Time string of current comment.
+ * @my_tz      Current timezone.
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header (unused here).
  * @record_hdr Current record header (unused here).
@@ -448,7 +472,7 @@ __printf_funct_t print_xml_comment(int *tab, int action, char *cur_date, char *c
  ***************************************************************************
  */
 __printf_funct_t print_json_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                   char *comment, struct file_header *file_hdr,
+                                   char *my_tz, char *comment, struct file_header *file_hdr,
                                    struct record_header *record_hdr)
 {
        static int sep = FALSE;
@@ -464,9 +488,11 @@ __printf_funct_t print_json_comment(int *tab, int action, char *cur_date, char *
                xprintf((*tab)++, "{");
                xprintf(*tab,
                        "\"comment\": {\"date\": \"%s\", \"time\": \"%s\", "
-                       "\"utc\": %d, \"com\": \"%s\"}",
+                       "\"tz\": \"%s\", \"com\": \"%s\"}",
                        cur_date, cur_time,
-                       !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0,
+                       PRINT_LOCAL_TIME(flags) ? my_tz
+                                               : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                         : "UTC"),
                        comment);
                xprintf0(--(*tab), "}");
                sep = TRUE;
@@ -489,20 +515,24 @@ __printf_funct_t print_json_comment(int *tab, int action, char *cur_date, char *
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message.
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone.
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header (unused here).
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
 __printf_funct_t print_raw_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                  char *comment, struct file_header *file_hdr,
+                                  char *my_tz, char *comment, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
        /* Actions F_BEGIN and F_END ignored */
        if (action & F_MAIN) {
                printf("%s", cur_time);
-               if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) {
-                       printf(" %s", PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC");
+               if (strlen(cur_date)) {
+                       printf(" %s",
+                              PRINT_LOCAL_TIME(flags) ? my_tz
+                                                      : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                                : "UTC"));
                }
                printf("; COM %s\n", comment);
        }
@@ -517,14 +547,14 @@ __printf_funct_t print_raw_comment(int *tab, int action, char *cur_date, char *c
  * @action     Action expected from current function.
  * @cur_date   Date string of current restart message (unused here).
  * @cur_time   Time string of current restart message (unused here).
- * @utc                True if @cur_time is expressed in UTC (unused here).
+ * @my_tz      Current timezone (unused here).
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header (unused here).
  * @record_hdr Current record header.
  ***************************************************************************
  */
 __printf_funct_t print_pcp_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                  char *comment, struct file_header *file_hdr,
+                                  char *my_tz, char *comment, struct file_header *file_hdr,
                                   struct record_header *record_hdr)
 {
 #ifdef HAVE_PCP
@@ -804,6 +834,7 @@ __printf_funct_t print_pcp_statistics(int *tab, int action, struct activity *act
  * @file_hdr   System activity file standard header.
  * @cur_date   Date string of current record.
  * @cur_time   Time string of current record.
+ * @my_tz      Current timezone.
  * @itv                Interval of time with preceding record.
  *
  * RETURNS:
@@ -811,12 +842,11 @@ __printf_funct_t print_pcp_statistics(int *tab, int action, struct activity *act
  ***************************************************************************
  */
 char *print_dbppc_timestamp(int fmt, struct file_header *file_hdr, char *cur_date,
-                           char *cur_time, unsigned long long itv)
+                           char *cur_time, char *my_tz, unsigned long long itv)
 {
        int isdb = (fmt == F_DB_OUTPUT);
        static char pre[512];
        char temp1[128], temp2[256];
-       int sep = !PRINT_LOCAL_TIME(flags);
 
        /* This substring appears on every output line, preformat it here */
        snprintf(temp1, sizeof(temp1), "%s%s%lld%s",
@@ -827,9 +857,11 @@ char *print_dbppc_timestamp(int fmt, struct file_header *file_hdr, char *cur_dat
        else {
                strcpy(temp2, temp1);
        }
-       snprintf(pre, sizeof(pre), "%s%s%s%s", temp2, cur_time, sep ? " " : "",
-                strlen(cur_date) && !PRINT_LOCAL_TIME(flags) ?
-                (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC") : "");
+       snprintf(pre, sizeof(pre), "%s%s %s", temp2, cur_time,
+                strlen(cur_date) ? (PRINT_LOCAL_TIME(flags) ? my_tz
+                                                            : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                                      : "UTC"))
+                                 : "");
        pre[sizeof(pre) - 1] = '\0';
 
        if (DISPLAY_HORIZONTALLY(flags)) {
@@ -848,6 +880,7 @@ char *print_dbppc_timestamp(int fmt, struct file_header *file_hdr, char *cur_dat
  * @action     Action expected from current function.
  * @cur_date   Date string of current record.
  * @cur_time   Time string of current record.
+ * @my_tz      Current timezone.
  * @itv                Interval of time with preceding record.
  * @record_hdr Record header for current sample (unused here).
  * @file_hdr   System activity file standard header.
@@ -858,12 +891,13 @@ char *print_dbppc_timestamp(int fmt, struct file_header *file_hdr, char *cur_dat
  ***************************************************************************
  */
 __tm_funct_t print_ppc_timestamp(void *parm, int action, char *cur_date,
-                                char *cur_time, unsigned long long itv,
+                                char *cur_time, char * my_tz, unsigned long long itv,
                                 struct record_header *record_hdr,
                                 struct file_header *file_hdr, unsigned int flags)
 {
        if (action & F_BEGIN) {
-               return print_dbppc_timestamp(F_PPC_OUTPUT, file_hdr, cur_date, cur_time, itv);
+               return print_dbppc_timestamp(F_PPC_OUTPUT, file_hdr, cur_date, cur_time,
+                                            my_tz, itv);
        }
 
        return NULL;
@@ -878,6 +912,7 @@ __tm_funct_t print_ppc_timestamp(void *parm, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current record.
  * @cur_time   Time string of current record.
+ * @my_tz      Current timezone.
  * @itv                Interval of time with preceding record.
  * @record_hdr Record header for current sample (unused here).
  * @file_hdr   System activity file standard header.
@@ -888,12 +923,13 @@ __tm_funct_t print_ppc_timestamp(void *parm, int action, char *cur_date,
  ***************************************************************************
  */
 __tm_funct_t print_db_timestamp(void *parm, int action, char *cur_date,
-                               char *cur_time, unsigned long long itv,
+                               char *cur_time, char *my_tz, unsigned long long itv,
                                struct record_header *record_hdr,
                                struct file_header *file_hdr, unsigned int flags)
 {
        if (action & F_BEGIN) {
-               return print_dbppc_timestamp(F_DB_OUTPUT, file_hdr, cur_date, cur_time, itv);
+               return print_dbppc_timestamp(F_DB_OUTPUT, file_hdr, cur_date, cur_time,
+                                            my_tz, itv);
        }
        if (action & F_END) {
                if (DISPLAY_HORIZONTALLY(flags)) {
@@ -913,6 +949,7 @@ __tm_funct_t print_db_timestamp(void *parm, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current comment.
  * @cur_time   Time string of current comment.
+ * @my_tz      Current timezone.
  * @itv                Interval of time with preceding record.
  * @record_hdr Record header for current sample (unused here).
  * @file_hdr   System activity file standard header (unused here).
@@ -920,16 +957,19 @@ __tm_funct_t print_db_timestamp(void *parm, int action, char *cur_date,
  ***************************************************************************
  */
 __tm_funct_t print_xml_timestamp(void *parm, int action, char *cur_date,
-                                char *cur_time, unsigned long long itv,
+                                char *cur_time, char *my_tz, unsigned long long itv,
                                 struct record_header *record_hdr,
                                 struct file_header *file_hdr, unsigned int flags)
 {
-       int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
        int *tab = (int *) parm;
 
        if (action & F_BEGIN) {
-               xprintf((*tab)++, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
-                       cur_date, cur_time, utc ? 1 : 0, itv);
+               xprintf((*tab)++, "<timestamp date=\"%s\" time=\"%s\" tz=\"%s\" interval=\"%llu\">",
+                       cur_date, cur_time,
+                       PRINT_LOCAL_TIME(flags) ? my_tz
+                                               : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                         : "UTC"),
+                       itv);
        }
        if (action & F_END) {
                xprintf(--(*tab), "</timestamp>");
@@ -947,6 +987,7 @@ __tm_funct_t print_xml_timestamp(void *parm, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current comment.
  * @cur_time   Time string of current comment.
+ * @my_tz      Current timezone.
  * @itv                Interval of time with preceding record.
  * @record_hdr Record header for current sample (unused here).
  * @file_hdr   System activity file standard header (unused here).
@@ -954,18 +995,21 @@ __tm_funct_t print_xml_timestamp(void *parm, int action, char *cur_date,
  ***************************************************************************
  */
 __tm_funct_t print_json_timestamp(void *parm, int action, char *cur_date,
-                                 char *cur_time, unsigned long long itv,
+                                 char *cur_time, char *my_tz, unsigned long long itv,
                                  struct record_header *record_hdr,
                                  struct file_header *file_hdr, unsigned int flags)
 {
-       int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
        int *tab = (int *) parm;
 
        if (action & F_BEGIN) {
                xprintf0(*tab,
                         "\"timestamp\": {\"date\": \"%s\", \"time\": \"%s\", "
-                        "\"utc\": %d, \"interval\": %llu}",
-                        cur_date, cur_time, utc ? 1 : 0, itv);
+                        "\"tz\": \"%s\", \"interval\": %llu}",
+                        cur_date, cur_time,
+                        PRINT_LOCAL_TIME(flags) ? my_tz
+                                                : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                          : "UTC"),
+                       itv);
        }
        if (action & F_MAIN) {
                printf(",\n");
@@ -986,6 +1030,7 @@ __tm_funct_t print_json_timestamp(void *parm, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current record.
  * @cur_time   Time string of current record.
+ * @my_tz      Current timezone.
  * @itv                Interval of time with preceding record (unused here).
  * @record_hdr Record header for current sample (unused here).
  * @file_hdr   System activity file standard header (unused here).
@@ -996,17 +1041,18 @@ __tm_funct_t print_json_timestamp(void *parm, int action, char *cur_date,
  ***************************************************************************
  */
 __tm_funct_t print_raw_timestamp(void *parm, int action, char *cur_date,
-                                char *cur_time, unsigned long long itv,
+                                char *cur_time, char *my_tz, unsigned long long itv,
                                 struct record_header *record_hdr,
                                 struct file_header *file_hdr, unsigned int flags)
 {
-       int sep = !PRINT_LOCAL_TIME(flags);
        static char pre[80];
 
        if (action & F_BEGIN) {
-               snprintf(pre, sizeof(pre), "%s%s%s", cur_time, sep ? " " : "",
-                        strlen(cur_date) && !PRINT_LOCAL_TIME(flags) ?
-                        (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC") : "");
+               snprintf(pre, sizeof(pre), "%s %s", cur_time,
+                        strlen(cur_date) ? (PRINT_LOCAL_TIME(flags) ? my_tz
+                                                                    : (PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname
+                                                                                              : "UTC"))
+                                         : "");
                pre[sizeof(pre) - 1] = '\0';
                return pre;
        }
@@ -1023,6 +1069,7 @@ __tm_funct_t print_raw_timestamp(void *parm, int action, char *cur_date,
  * @action     Action expected from current function.
  * @cur_date   Date string of current record (unused here).
  * @cur_time   Time string of current record (unused here).
+ * @my_tz      Current timezone (unused here).
  * @itv                Interval of time with preceding record (unused here).
  * @record_hdr Record header for current sample.
  * @file_hdr   System activity file standard header (unused here).
@@ -1033,7 +1080,7 @@ __tm_funct_t print_raw_timestamp(void *parm, int action, char *cur_date,
  ***************************************************************************
  */
 __tm_funct_t print_pcp_timestamp(void *parm, int action, char *cur_date,
-                                char *cur_time, unsigned long long itv,
+                                char *cur_time, char *my_tz, unsigned long long itv,
                                 struct record_header *record_hdr,
                                 struct file_header *file_hdr, unsigned int flags)
 {
@@ -1052,6 +1099,7 @@ __tm_funct_t print_pcp_timestamp(void *parm, int action, char *cur_date,
  * @parm       Specific parameter. Here: number of tabulations.
  * @action     Action expected from current function.
  * @dfile      Unused here (PCP archive file).
+ * @my_tz      Current timezone (unused here).
  * @file_magic System activity file magic header.
  * @file_hdr   System activity file standard header.
  * @act                Array of activities (unused here).
@@ -1062,7 +1110,7 @@ __tm_funct_t print_pcp_timestamp(void *parm, int action, char *cur_date,
  * @parm       Number of tabulations.
  ***************************************************************************
  */
-__printf_funct_t print_xml_header(void *parm, int action, char *dfile,
+__printf_funct_t print_xml_header(void *parm, int action, char *dfile, char *my_tz,
                                  struct file_magic *file_magic,
                                  struct file_header *file_hdr,
                                  struct activity *act[], unsigned int id_seq[],
@@ -1122,6 +1170,7 @@ __printf_funct_t print_xml_header(void *parm, int action, char *dfile,
  * @parm       Specific parameter. Here: number of tabulations.
  * @action     Action expected from current function.
  * @dfile      Unused here (PCP archive file).
+ * @my_tz      Current timezone (unused here).
  * @file_magic System activity file magic header.
  * @file_hdr   System activity file standard header.
  * @act                Array of activities (unused here).
@@ -1132,7 +1181,7 @@ __printf_funct_t print_xml_header(void *parm, int action, char *dfile,
  * @parm       Number of tabulations.
  ***************************************************************************
  */
-__printf_funct_t print_json_header(void *parm, int action, char *dfile,
+__printf_funct_t print_json_header(void *parm, int action, char *dfile, char *my_tz,
                                   struct file_magic *file_magic,
                                   struct file_header *file_hdr,
                                   struct activity *act[], unsigned int id_seq[],
@@ -1184,6 +1233,7 @@ __printf_funct_t print_json_header(void *parm, int action, char *dfile,
  * @parm       Specific parameter (unused here).
  * @action     Action expected from current function.
  * @dfile      Name of system activity data file (unused here).
+ * @my_tz      Current timezone (unused here).
  * @file_magic System activity file magic header.
  * @file_hdr   System activity file standard header.
  * @act                Array of activities.
@@ -1191,7 +1241,7 @@ __printf_funct_t print_json_header(void *parm, int action, char *dfile,
  * @file_actlst        List of (known or unknown) activities in file.
  ***************************************************************************
  */
-__printf_funct_t print_hdr_header(void *parm, int action, char *dfile,
+__printf_funct_t print_hdr_header(void *parm, int action, char *dfile, char *my_tz,
                                  struct file_magic *file_magic,
                                  struct file_header *file_hdr,
                                  struct activity *act[], unsigned int id_seq[],
@@ -1287,6 +1337,7 @@ __printf_funct_t print_hdr_header(void *parm, int action, char *dfile,
  *             max number of views on a single row (@views_per_row).
  * @action     Action expected from current function.
  * @dfile      Name of system activity data file (unused here).
+ * @my_tz      Current timezone (unused here).
  * @file_magic System activity file magic header (unused here).
  * @file_hdr   System activity file standard header.
  * @act                Array of activities (unused here).
@@ -1294,7 +1345,7 @@ __printf_funct_t print_hdr_header(void *parm, int action, char *dfile,
  * @file_actlst        List of (known or unknown) activities in file (unused here).
  ***************************************************************************
  */
-__printf_funct_t print_svg_header(void *parm, int action, char *dfile,
+__printf_funct_t print_svg_header(void *parm, int action, char *dfile, char *my_tz,
                                  struct file_magic *file_magic,
                                  struct file_header *file_hdr,
                                  struct activity *act[], unsigned int id_seq[],
@@ -1394,6 +1445,7 @@ __printf_funct_t print_svg_header(void *parm, int action, char *dfile,
  * @parm       Specific parameter (unused here).
  * @action     Action expected from current function.
  * @dfile      Name of PCP archive file.
+ * @my_tz      Current timezone.
  * @file_magic System activity file magic header (unused here).
  * @file_hdr   System activity file standard header (unused here).
  * @act                Array of activities (unused here).
@@ -1401,7 +1453,7 @@ __printf_funct_t print_svg_header(void *parm, int action, char *dfile,
  * @file_actlst        List of (known or unknown) activities in file (unused here).
  ***************************************************************************
  */
-__printf_funct_t print_pcp_header(void *parm, int action, char *dfile,
+__printf_funct_t print_pcp_header(void *parm, int action, char *dfile, char *my_tz,
                                  struct file_magic *file_magic,
                                  struct file_header *file_hdr,
                                  struct activity *act[], unsigned int id_seq[],
@@ -1418,7 +1470,7 @@ __printf_funct_t print_pcp_header(void *parm, int action, char *dfile,
                pmiStart(dfile, FALSE);
 
                if (PRINT_LOCAL_TIME(flags)) {
-                       pmiSetTimezone(file_hdr->sa_tzname);
+                       pmiSetTimezone(my_tz);
                }
                else {
                        pmiSetTimezone("UTC");
@@ -1456,7 +1508,7 @@ __printf_funct_t print_pcp_header(void *parm, int action, char *dfile,
 
        if (action & F_END) {
                if (action & F_BEGIN) {
-                       /* Only the header data will be written to PCP archive */
+                       /* Only the header data will be written to PCP archive (option -H) */
                        if (!PRINT_LOCAL_TIME(flags)) {
                                /* Convert a time_t value from local time to UTC */
                                if (gmtime_r(&t, &lrectime)) {
diff --git a/sar.c b/sar.c
index a20c31e6d0c3ba9a0c253611268b9dea1a251ee0..0bc291078b913fdb62fb3133cb1fdbb95b57a486 100644 (file)
--- a/sar.c
+++ b/sar.c
@@ -605,13 +605,14 @@ size_t sa_read(void *buffer, size_t size)
  * @action     Action expected from current function (unused here).
  * @cur_date   Date string of current restart message (unused here).
  * @cur_time   Time string of current restart message.
+ * @my_tz      Current timezone (unused here).
  * @file_hdr   System activity file standard header.
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
 __printf_funct_t print_sar_restart(int *tab, int action, char *cur_date, char *cur_time,
-                                 struct file_header *file_hdr,
-                                 struct record_header *record_hdr)
+                                  char *my_tz, struct file_header *file_hdr,
+                                  struct record_header *record_hdr)
 {
        char restart[64];
 
@@ -631,13 +632,14 @@ __printf_funct_t print_sar_restart(int *tab, int action, char *cur_date, char *c
  * @action     Action expected from current function (unused here).
  * @cur_date   Date string of current comment (unused here).
  * @cur_time   Time string of current comment.
+ * @my_tz      Current timezone (unused here).
  * @comment    Comment to display.
  * @file_hdr   System activity file standard header (unused here).
  * @record_hdr Current record header (unused here).
  ***************************************************************************
  */
 __print_funct_t print_sar_comment(int *tab, int action, char *cur_date, char *cur_time,
-                                 char *comment, struct file_header *file_hdr,
+                                 char *my_tz, char *comment, struct file_header *file_hdr,
                                  struct record_header *record_hdr)
 {
        printf("%-11s", cur_time);
@@ -808,7 +810,7 @@ void handle_curr_act_stats(int ifd, off_t fpos, int *curr, long *cnt, int *eosaf
                        /* Display comment */
                        next = print_special_record(&record_hdr[*curr], flags + S_F_LOCAL_TIME,
                                                    &tm_start, &tm_end, R_COMMENT, ifd,
-                                                   &rectime, file, 0,
+                                                   &rectime, file, 0, NULL,
                                                    file_magic, &file_hdr, act, &sar_fmt,
                                                    endian_mismatch, arch_64);
                        if (next && lines) {
@@ -1038,7 +1040,7 @@ void read_stats_from_file(char from_file[])
                        if ((rtype == R_RESTART) || (rtype == R_COMMENT)) {
                                print_special_record(&record_hdr[0], flags + S_F_LOCAL_TIME,
                                                     &tm_start, &tm_end, rtype, ifd,
-                                                    &rectime, from_file, 0, &file_magic,
+                                                    &rectime, from_file, 0, NULL, &file_magic,
                                                     &file_hdr, act, &sar_fmt, endian_mismatch, arch_64);
                        }
                        else {
@@ -1147,7 +1149,7 @@ void read_stats_from_file(char from_file[])
                                        /* This was a COMMENT record: Print it */
                                        print_special_record(&record_hdr[curr], flags + S_F_LOCAL_TIME,
                                                             &tm_start, &tm_end, R_COMMENT, ifd,
-                                                            &rectime, from_file, 0,
+                                                            &rectime, from_file, 0, NULL,
                                                             &file_magic, &file_hdr, act, &sar_fmt,
                                                             endian_mismatch, arch_64);
                                }
@@ -1159,7 +1161,7 @@ void read_stats_from_file(char from_file[])
                if (!eosaf && (record_hdr[curr].record_type == R_RESTART)) {
                        print_special_record(&record_hdr[curr], flags + S_F_LOCAL_TIME,
                                             &tm_start, &tm_end, R_RESTART, ifd,
-                                            &rectime, from_file, 0,
+                                            &rectime, from_file, 0, NULL,
                                             &file_magic, &file_hdr, act, &sar_fmt,
                                             endian_mismatch, arch_64);
                }
index 0ebf1ed802c210782ecbb386006de8a6b2bb1025..e1d88a9d1c6371e8954c6196dc3fd2e53f91031d 100644 (file)
@@ -742,12 +742,12 @@ void display_vgrid(long int xpos, double xfactor, int v_gridnr, struct svg_parm
                compute_next_graduation_timestamp(&stamp, xpos);
        }
 
-       if (!PRINT_LOCAL_TIME(flags)) {
-               printf("<text x=\"-10\" y=\"30\" style=\"fill: #%06x; stroke: none; font-size: 12px; "
-                      "text-anchor: end\">%s</text>\n",
-                      svg_colors[palette][SVG_COL_INFO_IDX],
-                      PRINT_TRUE_TIME(flags) ? svg_p->file_hdr->sa_tzname : "UTC");
-       }
+       printf("<text x=\"-10\" y=\"30\" style=\"fill: #%06x; stroke: none; font-size: 12px; "
+              "text-anchor: end\">%s</text>\n",
+              svg_colors[palette][SVG_COL_INFO_IDX],
+              PRINT_LOCAL_TIME(flags) ? svg_p->my_tzname
+                                      : (PRINT_TRUE_TIME(flags) ? svg_p->file_hdr->sa_tzname
+                                                                : "UTC"));
 }
 
 /*