From eca99b33c0ff111c89f5e8c8d4ce1c199aee75fc Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 30 Mar 2018 20:29:15 +0100 Subject: [PATCH] lsd,lsf: make sure all times we output are in local time - fixes #2183 Previous to this change times from lsd/lsf were output in whatever timezone they were in whereas times from lsl were converted to localtime. --- fs/operations/operations.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index 6c930c035..fdba32ca0 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -915,7 +915,7 @@ func ListDir(f fs.Fs, w io.Writer) error { } entries.ForDir(func(dir fs.Directory) { if dir != nil { - syncFprintf(w, "%12d %13s %9d %s\n", dir.Size(), dir.ModTime().Format("2006-01-02 15:04:05"), dir.Items(), dir.Remote()) + syncFprintf(w, "%12d %13s %9d %s\n", dir.Size(), dir.ModTime().Local().Format("2006-01-02 15:04:05"), dir.Items(), dir.Remote()) } }) return nil @@ -1080,7 +1080,7 @@ func dedupeInteractive(remote string, objs []fs.Object) { if err != nil { md5sum = err.Error() } - fmt.Printf(" %d: %12d bytes, %s, md5sum %32s\n", i+1, o.Size(), o.ModTime().Format("2006-01-02 15:04:05.000000000"), md5sum) + fmt.Printf(" %d: %12d bytes, %s, md5sum %32s\n", i+1, o.Size(), o.ModTime().Local().Format("2006-01-02 15:04:05.000000000"), md5sum) } switch config.Command([]string{"sSkip and do nothing", "kKeep just one (choose which in next step)", "rRename all to be different (by changing file.jpg to file-1.jpg)"}) { case 's': @@ -1676,7 +1676,7 @@ func (l *ListFormat) SetOutput(output []func() string) { // AddModTime adds file's Mod Time to output func (l *ListFormat) AddModTime() { - l.AppendOutput(func() string { return l.entry.ModTime().Format("2006-01-02 15:04:05") }) + l.AppendOutput(func() string { return l.entry.ModTime().Local().Format("2006-01-02 15:04:05") }) } // AddSize adds file's size to output