From 5f20ae707d1653dfa56da5ec2ac9746d63aea756 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 22 Sep 2015 19:04:12 +0100 Subject: [PATCH] Make lsl output times in localtime and fix tests - fixes #141 --- fs/operations.go | 2 +- fs/operations_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/operations.go b/fs/operations.go index 19befd079..430b83753 100644 --- a/fs/operations.go +++ b/fs/operations.go @@ -651,7 +651,7 @@ func ListLong(f Fs, w io.Writer) error { Stats.Checking(o) modTime := o.ModTime() Stats.DoneChecking(o) - syncFprintf(w, "%9d %s %s\n", o.Size(), modTime.Format("2006-01-02 15:04:05.000000000"), o.Remote()) + syncFprintf(w, "%9d %s %s\n", o.Size(), modTime.Local().Format("2006-01-02 15:04:05.000000000"), o.Remote()) }) } diff --git a/fs/operations_test.go b/fs/operations_test.go index 69da0a14a..313bcebae 100644 --- a/fs/operations_test.go +++ b/fs/operations_test.go @@ -485,8 +485,9 @@ func TestLsLong(t *testing.T) { timeFormat := "2006-01-02 15:04:05.000000000" precision := fremote.Precision() + location := time.Now().Location() checkTime := func(m, filename string, expected time.Time) { - modTime, err := time.Parse(timeFormat, m) + modTime, err := time.ParseInLocation(timeFormat, m, location) // parse as localtime if err != nil { t.Errorf("Error parsing %q: %v", m, err) } else {