From e551d734fbfc7b166ede32bd82b2b9d1a3b9c47b Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 31 Jan 2023 23:25:59 +0900 Subject: [PATCH] pkg/epoch: drop timezone For determinism of human-readable string representation. e.g., "2023-01-10T12:34:56Z" vs "2023-01-10T21:34:56+09:00" Signed-off-by: Akihiro Suda --- pkg/epoch/epoch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/epoch/epoch.go b/pkg/epoch/epoch.go index 0ab36b6e5..0ba8ed3b1 100644 --- a/pkg/epoch/epoch.go +++ b/pkg/epoch/epoch.go @@ -41,7 +41,7 @@ func SourceDateEpoch() (*time.Time, error) { if err != nil { return nil, fmt.Errorf("invalid %s value %q: %w", SourceDateEpochEnv, v, err) } - unix := time.Unix(i64, 0) + unix := time.Unix(i64, 0).UTC() return &unix, nil } @@ -55,7 +55,7 @@ func SourceDateEpochOrNow() time.Time { if epoch != nil { return *epoch } - return time.Now() + return time.Now().UTC() } // SetSourceDateEpoch sets the SOURCE_DATE_EPOCH env var.