]> granicus.if.org Git - sysstat/commitdiff
Compare UTC time properly format agnostic
authorNathanael P Wilson <Nathanael.P.Wilson@aexp.com>
Fri, 2 Sep 2022 16:38:59 +0000 (09:38 -0700)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 7 Jan 2023 13:48:10 +0000 (14:48 +0100)
sa_common.c

index 4de72b5bf129f1f941e5ea28c0ed94eb20abc83a..3fe866a881c3fd7ce7f0e67f8f307e0ac1bd5921 100644 (file)
@@ -2897,11 +2897,7 @@ int sa_get_record_timestamp_struct(uint64_t l_flags, struct record_header *recor
        time_t t = record_hdr->ust_time;
        int rc = 0;
 
-       /*
-        * Fill generic rectime structure in local time.
-        * Done so that we have some default values.
-        */
-       ltm = localtime_r(&t, rectime);
+       
 
        if (!PRINT_LOCAL_TIME(l_flags) && !PRINT_TRUE_TIME(l_flags)) {
                /*
@@ -2909,6 +2905,13 @@ int sa_get_record_timestamp_struct(uint64_t l_flags, struct record_header *recor
                 * (the user doesn't want local time nor time of file's creator).
                 */
                ltm = gmtime_r(&t, rectime);
+       } else {
+               /*
+               * Fill generic rectime structure in local time.
+               * Done so that we have some default values.
+               */
+               ltm = localtime_r(&t, rectime);
+               rectime->tm_gmtoff = TRUE;
        }
 
        if (!ltm) {