diff mbox series

[CIFSUTILS,SMBINFO] Do not convert snapshot time to local time zone

Message ID CAH2r5mt7UjqRRCcdRt6Hw-VxLibasFuRWVAXzgWO+L4AD=FzVw@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [CIFSUTILS,SMBINFO] Do not convert snapshot time to local time zone | expand

Commit Message

Steve French April 2, 2019, 11:24 p.m. UTC
We  get snapshot times in GMT time, but need to convert them
    to DCE time (SMB time format) without changing the time zone.

Comments

ronnie sahlberg April 2, 2019, 11:55 p.m. UTC | #1
Reviewed-by me

On Wed, Apr 3, 2019 at 9:25 AM Steve French via samba-technical
<samba-technical@lists.samba.org> wrote:
>
>     We  get snapshot times in GMT time, but need to convert them
>     to DCE time (SMB time format) without changing the time zone.
>
> --
> Thanks,
>
> Steve
diff mbox series

Patch

From 64a2ba46f67c89356917cacde12443d0fa7901f6 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Tue, 2 Apr 2019 18:20:07 -0500
Subject: [PATCH] smbinfo: snapshots are returned in gmt time so don't convert
 timezone

We  display snapshot times in GMT time, but need to convert them
to DCE time (SMB time format) without changing the time zone.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 smbinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/smbinfo.c b/smbinfo.c
index d7a6431..c00f89b 100644
--- a/smbinfo.c
+++ b/smbinfo.c
@@ -1009,7 +1009,7 @@  static void print_snapshots(struct smb_snapshot_array *psnap)
 			unsigned long long dce_time;
 			j = 0;
 			strptime(gmt_token, GMT_FORMAT, &tm);
-			dce_time = mktime(&tm) * 10000000 + NTFS_TIME_OFFSET;
+			dce_time = timegm(&tm) * 10000000 + NTFS_TIME_OFFSET;
 			printf("\n   SMB3:%lld ", dce_time);
 		}
 	}
-- 
2.17.1