From 5366d9dc1934b408dc3682b22f69674507481b04 Mon Sep 17 00:00:00 2001 From: Ryan Kohler Date: Thu, 11 Mar 2021 15:33:11 +0000 Subject: [PATCH] google: Make sure time is always in UTC If times are stored in different time zones, then we occasionally get heisenbugs about expired tokens Change-Id: I0c117977688d8d6c7b12b211092e5040a41a1f46 GitHub-Last-Rev: 3ff51b34f58e0bde7946af59e1215b7d3db65a95 GitHub-Pull-Request: golang/oauth2#482 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/300929 Reviewed-by: Tyler Bui-Palsulich Trust: Tyler Bui-Palsulich Trust: Cody Oss Run-TryBot: Tyler Bui-Palsulich TryBot-Result: Go Bot --- google/internal/externalaccount/basecredentials.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/internal/externalaccount/basecredentials.go b/google/internal/externalaccount/basecredentials.go index 1b87c09..1a6e93c 100644 --- a/google/internal/externalaccount/basecredentials.go +++ b/google/internal/externalaccount/basecredentials.go @@ -14,7 +14,9 @@ import ( ) // now aliases time.Now for testing -var now = time.Now +var now = func() time.Time { + return time.Now().UTC() +} // Config stores the configuration for fetching tokens with external credentials. type Config struct {