Skip to content

Commit

Permalink
Console Event IDs: Use UTC timestamps
Browse files Browse the repository at this point in the history
The `NewConsoleEventID` function is supposed to return a deterministic
string in relation to a given console.

The `time.Time` object contains data about the local timezone, and
`time.Format()` uses this, therefore stamping out a timestamp string
which matches local time.

We never want to do this; the string returned from this function should
be the same across all environments, regardless of what the local
timezone is set to, therefore we need to convert to UTC before
formatting.
  • Loading branch information
benwh committed Jun 17, 2022
1 parent 42854e9 commit 5a9cba6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.1
3.8.2
2 changes: 1 addition & 1 deletion pkg/workloads/console/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type ConsoleTerminatedEvent struct {
func NewConsoleEventID(context, namespace, console string, time time.Time) string {
return strings.Join([]string{
// year (2006) month (01) day (02) hour (15) minute (04) second (05)
time.Format("20060102150405"),
time.UTC().Format("20060102150405"),
context, namespace, console,
}, "/")
}

0 comments on commit 5a9cba6

Please sign in to comment.