Skip to content

time: system TZ is UTC, but time.Local != time.UTC #9832

@pbnjay

Description

@pbnjay

This was a very unexpected bug, considering all output and other logging statements matched up.

$ cat tt.go

package main

import (
    "fmt"
    "time"
)

func main() {
    t1 := time.Now()
    t2 := t1.UTC()
    fmt.Println(t1, " == ", t2, " => ", t1==t2)
}

$ go run tt.go

2015-02-10 19:51:15.366942319 +0000 UTC  ==  2015-02-10 19:51:15.366942319 +0000 UTC  =>  false

go version devel +2d02ff2 Sat Dec 13 10:18:27 2014 +0000 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions