From 42c4a25ecea98695c1d2d5e9d4e90002345b038d Mon Sep 17 00:00:00 2001 From: Nathanael P Wilson Date: Fri, 2 Sep 2022 09:38:59 -0700 Subject: [PATCH] Compare UTC time properly format agnostic --- sa_common.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sa_common.c b/sa_common.c index 4de72b5..3fe866a 100644 --- a/sa_common.c +++ b/sa_common.c @@ -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) { -- 2.50.1