From 81354288e26fc7ca2c5a3344c33ab77baaa4fd4d Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Tue, 13 Sep 2022 15:07:07 +0200 Subject: [PATCH] sadf: Print time zone instead of UTC in true time mode This patch expands the scope of patch 217ee12 for all formats generated by sadf. Signed-off-by: Sebastien GODARD --- sa.h | 8 ++-- sa_common.c | 8 +--- sadf.c | 19 ++++------ sadf.h | 26 ++++++------- sadf_misc.c | 106 ++++++++++++++++++++++++---------------------------- sar.c | 6 +-- 6 files changed, 76 insertions(+), 97 deletions(-) diff --git a/sa.h b/sa.h index cfaeeed..202abaa 100644 --- a/sa.h +++ b/sa.h @@ -1187,12 +1187,12 @@ struct report_format { /* * This function displays the restart messages. */ - __printf_funct_t (*f_restart) (int *, int, char *, char *, int, + __printf_funct_t (*f_restart) (int *, int, char *, char *, struct file_header *, struct record_header *); /* * This function displays the comments. */ - __printf_funct_t (*f_comment) (int *, int, char *, char *, int, char *, + __printf_funct_t (*f_comment) (int *, int, char *, char *, char *, struct file_header *, struct record_header *); /* * This is the main function used to display all the statistics for current format. @@ -1561,10 +1561,10 @@ int parse_timestamp void print_report_hdr (uint64_t, struct tm *, struct file_header *); void print_sar_comment - (int *, int, char *, char *, int, char *, struct file_header *, + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_sar_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, 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 *, diff --git a/sa_common.c b/sa_common.c index da22ee0..cbac915 100644 --- a/sa_common.c +++ b/sa_common.c @@ -3016,9 +3016,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, - !PRINT_LOCAL_TIME(l_flags) && - !PRINT_TRUE_TIME(l_flags), file_hdr, record_hdr); + (*ofmt->f_restart)(&tab, F_MAIN, cur_date, cur_time, file_hdr, record_hdr); } } else if (rtype == R_COMMENT) { @@ -3036,9 +3034,7 @@ int print_special_record(struct record_header *record_hdr, uint64_t l_flags, if (*ofmt->f_comment) { (*ofmt->f_comment)(&tab, F_MAIN, cur_date, cur_time, - !PRINT_LOCAL_TIME(l_flags) && - !PRINT_TRUE_TIME(l_flags), file_comment, - file_hdr, record_hdr); + file_comment, file_hdr, record_hdr); } } diff --git a/sadf.c b/sadf.c index b6b39b5..192394e 100644 --- a/sadf.c +++ b/sadf.c @@ -1049,11 +1049,10 @@ 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, FALSE, - &file_hdr, NULL); + (*fmt[f_position]->f_restart)(&tab, F_BEGIN, NULL, NULL, &file_hdr, NULL); } if (DISPLAY_COMMENT(flags) && (*fmt[f_position]->f_comment)) { - (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, 0, NULL, + (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, NULL, &file_hdr, NULL); } } @@ -1135,11 +1134,10 @@ 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, - FALSE, &file_hdr, NULL); + (*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, &file_hdr, NULL); } if (DISPLAY_COMMENT(flags) && (*fmt[f_position]->f_comment)) { - (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, 0, NULL, + (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, NULL, &file_hdr, NULL); } goto terminate; @@ -1150,8 +1148,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, FALSE, - &file_hdr, NULL); + (*fmt[f_position]->f_restart)(&tab, F_BEGIN, NULL, NULL, &file_hdr, NULL); } do { @@ -1162,7 +1159,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, FALSE, &file_hdr, NULL); + (*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, &file_hdr, NULL); } /* Rewind file */ @@ -1171,7 +1168,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, 0, NULL, + (*fmt[f_position]->f_comment)(&tab, F_BEGIN, NULL, NULL, NULL, &file_hdr, NULL); } do { @@ -1182,7 +1179,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, 0, NULL, + (*fmt[f_position]->f_comment)(&tab, F_END, NULL, NULL, NULL, &file_hdr, NULL); } } diff --git a/sadf.h b/sadf.h index 1408510..f46cadf 100644 --- a/sadf.h +++ b/sadf.h @@ -114,35 +114,33 @@ void convert_file * Prototypes used to display restart messages */ __printf_funct_t print_db_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_ppc_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_xml_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_json_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_raw_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_pcp_restart - (int *, int, char *, char *, int, struct file_header *, struct record_header *); + (int *, int, char *, char *, struct file_header *, struct record_header *); /* * Prototypes used to display comments */ __printf_funct_t print_db_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_ppc_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_xml_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_json_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); -__printf_funct_t print_sar_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_raw_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); __printf_funct_t print_pcp_comment - (int *, int, char *, char *, int, char *, struct file_header *, struct record_header *); + (int *, int, char *, char *, char *, struct file_header *, struct record_header *); /* * Prototypes used to display the statistics part of the report diff --git a/sadf_misc.c b/sadf_misc.c index 8d69d50..db509bf 100644 --- a/sadf_misc.c +++ b/sadf_misc.c @@ -102,12 +102,11 @@ 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. - * @utc True if @cur_time is expressed in UTC. * @sep Character used as separator. * @file_hdr System activity file standard header. *************************************************************************** */ -void print_dbppc_restart(char *cur_date, char *cur_time, int utc, char sep, +void print_dbppc_restart(char *cur_date, char *cur_time, char sep, struct file_header *file_hdr) { printf("%s%c-1%c", file_hdr->sa_nodename, sep, sep); @@ -115,8 +114,8 @@ void print_dbppc_restart(char *cur_date, char *cur_time, int utc, char sep, printf("%s ", cur_date); } printf("%s", cur_time); - if (strlen(cur_date) && utc) { - printf(" UTC"); + if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) { + printf(" %s", 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); @@ -131,18 +130,17 @@ void print_dbppc_restart(char *cur_date, char *cur_time, int utc, char sep, * @action Action expected from current function. * @cur_date Date string of current restart message. * @cur_time Time string of current restart message. - * @utc True if @cur_time is expressed in UTC. * @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, int utc, struct file_header *file_hdr, + char *cur_time, 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, utc, ';', file_hdr); + print_dbppc_restart(cur_date, cur_time, ';', file_hdr); } } @@ -155,18 +153,17 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @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, int utc, struct file_header *file_hdr, + char *cur_time, 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, utc, '\t', file_hdr); + print_dbppc_restart(cur_date, cur_time, '\t', file_hdr); } } @@ -179,7 +176,6 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @file_hdr System activity file standard header. * @record_hdr Current record header (unused here). * @@ -188,7 +184,7 @@ __printf_funct_t print_ppc_restart(int *tab, int action, char *cur_date, *************************************************************************** */ __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date, - char *cur_time, int utc, struct file_header *file_hdr, + char *cur_time, struct file_header *file_hdr, struct record_header *record_hdr) { if (action & F_BEGIN) { @@ -196,7 +192,8 @@ __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date, } if (action & F_MAIN) { xprintf(*tab, "", - cur_date, cur_time, utc ? 1 : 0, + cur_date, cur_time, + !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0, file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1); } if (action & F_END) { @@ -213,7 +210,6 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @file_hdr System activity file standard header. * @record_hdr Current record header (unused here). * @@ -222,7 +218,7 @@ __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date, *************************************************************************** */ __printf_funct_t print_json_restart(int *tab, int action, char *cur_date, - char *cur_time, int utc, struct file_header *file_hdr, + char *cur_time, struct file_header *file_hdr, struct record_header *record_hdr) { static int sep = FALSE; @@ -237,7 +233,8 @@ __printf_funct_t print_json_restart(int *tab, int action, char *cur_date, } xprintf((*tab)++, "{"); xprintf(*tab, "\"boot\": {\"date\": \"%s\", \"time\": \"%s\", \"utc\": %d, \"cpu_count\": %d}", - cur_date, cur_time, utc ? 1 : 0, + cur_date, cur_time, + !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0, file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1); xprintf0(--(*tab), "}"); sep = TRUE; @@ -260,20 +257,19 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @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, int utc, struct file_header *file_hdr, + char *cur_time, 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) && utc) { - printf(" UTC"); + if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) { + printf(" %s", 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); @@ -289,13 +285,12 @@ __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). - * @utc True if @cur_time is expressed in UTC (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, - int utc, struct file_header *file_hdr, + struct file_header *file_hdr, struct record_header *record_hdr) { #ifdef HAVE_PCP @@ -335,22 +330,21 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @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, int utc, - char *comment, char sep, struct file_header *file_hdr) +void print_dbppc_comment(char *cur_date, char *cur_time, char *comment, + char sep, struct file_header *file_hdr) { printf("%s%c-1%c", file_hdr->sa_nodename, sep, sep); if (strlen(cur_date)) { printf("%s ", cur_date); } printf("%s", cur_time); - if (strlen(cur_date) && utc) { - printf(" UTC"); + if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) { + printf(" %s", PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC"); } printf("%cCOM %s\n", sep, comment); } @@ -364,20 +358,18 @@ void print_dbppc_comment(char *cur_date, char *cur_time, int utc, * @action Action expected from current function. * @cur_date Date string of current restart message. * @cur_time Time string of current restart message. - * @utc True if @cur_time is expressed in UTC. * @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, - int utc, char *comment, struct file_header *file_hdr, + 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, utc, comment, - ';', file_hdr); + print_dbppc_comment(cur_date, cur_time, comment, ';', file_hdr); } } @@ -390,20 +382,18 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @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, - int utc, char *comment, struct file_header *file_hdr, + 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, utc, comment, - '\t', file_hdr); + print_dbppc_comment(cur_date, cur_time, comment, '\t', file_hdr); } } @@ -416,7 +406,6 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @comment Comment to display. * @file_hdr System activity file standard header (unused here). * @record_hdr Current record header (unused here). @@ -426,7 +415,7 @@ __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, - int utc, char *comment, struct file_header *file_hdr, + char *comment, struct file_header *file_hdr, struct record_header *record_hdr) { if (action & F_BEGIN) { @@ -434,7 +423,9 @@ __printf_funct_t print_xml_comment(int *tab, int action, char *cur_date, char *c } if (action & F_MAIN) { xprintf(*tab, "", - cur_date, cur_time, utc ? 1 : 0, comment); + cur_date, cur_time, + !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0, + comment); } if (action & F_END) { xprintf(--(*tab), ""); @@ -450,7 +441,6 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @comment Comment to display. * @file_hdr System activity file standard header (unused here). * @record_hdr Current record header (unused here). @@ -460,7 +450,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, - int utc, char *comment, struct file_header *file_hdr, + char *comment, struct file_header *file_hdr, struct record_header *record_hdr) { static int sep = FALSE; @@ -477,7 +467,9 @@ __printf_funct_t print_json_comment(int *tab, int action, char *cur_date, char * xprintf(*tab, "\"comment\": {\"date\": \"%s\", \"time\": \"%s\", " "\"utc\": %d, \"com\": \"%s\"}", - cur_date, cur_time, utc ? 1 : 0, comment); + cur_date, cur_time, + !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags) ? 1 : 0, + comment); xprintf0(--(*tab), "}"); sep = TRUE; } @@ -499,21 +491,20 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @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, - int utc, char *comment, struct file_header *file_hdr, + 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) && utc) { - printf(" UTC"); + if (strlen(cur_date) && !PRINT_LOCAL_TIME(flags)) { + printf(" %s", PRINT_TRUE_TIME(flags) ? file_hdr->sa_tzname : "UTC"); } printf("; COM %s\n", comment); } @@ -535,7 +526,7 @@ __printf_funct_t print_raw_comment(int *tab, int action, char *cur_date, char *c *************************************************************************** */ __printf_funct_t print_pcp_comment(int *tab, int action, char *cur_date, char *cur_time, - int utc, char *comment, struct file_header *file_hdr, + char *comment, struct file_header *file_hdr, struct record_header *record_hdr) { #ifdef HAVE_PCP @@ -815,7 +806,6 @@ __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. - * @utc True if @cur_time is expressed in UTC. * @itv Interval of time with preceding record. * * RETURNS: @@ -823,11 +813,12 @@ __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, int utc, unsigned long long itv) + char *cur_time, 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", @@ -838,8 +829,9 @@ 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", temp2, cur_time, - strlen(cur_date) && utc ? " UTC" : ""); + 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") : ""); pre[sizeof(pre) - 1] = '\0'; if (DISPLAY_HORIZONTALLY(flags)) { @@ -872,10 +864,8 @@ __tm_funct_t print_ppc_timestamp(void *parm, int action, char *cur_date, struct record_header *record_hdr, struct file_header *file_hdr, unsigned int flags) { - int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags); - if (action & F_BEGIN) { - return print_dbppc_timestamp(F_PPC_OUTPUT, file_hdr, cur_date, cur_time, utc, itv); + return print_dbppc_timestamp(F_PPC_OUTPUT, file_hdr, cur_date, cur_time, itv); } return NULL; @@ -904,10 +894,8 @@ __tm_funct_t print_db_timestamp(void *parm, int action, char *cur_date, struct record_header *record_hdr, struct file_header *file_hdr, unsigned int flags) { - int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags); - if (action & F_BEGIN) { - return print_dbppc_timestamp(F_DB_OUTPUT, file_hdr, cur_date, cur_time, utc, itv); + return print_dbppc_timestamp(F_DB_OUTPUT, file_hdr, cur_date, cur_time, itv); } if (action & F_END) { if (DISPLAY_HORIZONTALLY(flags)) { @@ -1014,11 +1002,13 @@ __tm_funct_t print_raw_timestamp(void *parm, int action, char *cur_date, struct record_header *record_hdr, struct file_header *file_hdr, unsigned int flags) { - int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags); + int sep = !PRINT_LOCAL_TIME(flags); static char pre[80]; if (action & F_BEGIN) { - snprintf(pre, sizeof(pre), "%s%s", cur_time, strlen(cur_date) && utc ? " UTC" : ""); + 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") : ""); pre[sizeof(pre) - 1] = '\0'; return pre; } diff --git a/sar.c b/sar.c index ee9b97e..a20c31e 100644 --- a/sar.c +++ b/sar.c @@ -605,13 +605,12 @@ 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. - * @utc True if @cur_time is expressed in UTC (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, - int utc, struct file_header *file_hdr, + struct file_header *file_hdr, struct record_header *record_hdr) { char restart[64]; @@ -632,13 +631,12 @@ __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. - * @utc True if @cur_time is expressed in UTC (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, int utc, +__print_funct_t print_sar_comment(int *tab, int action, char *cur_date, char *cur_time, char *comment, struct file_header *file_hdr, struct record_header *record_hdr) { -- 2.50.1