8000 time: Time has different precision depending on the operating system · Issue #41087 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
time: Time has different precision depending on the operating system #41087
Open
@davidterranova

Description

@davidterranova

What version of Go are you using (go version)?

$ go version
go version go1.13.12 darwin/amd64

Does this issue reproduce with the latest release?

$ go version
go version go1.15 darwin/amd64
$ go run main.go
2020-08-28 10:37:50.388561 +0200 CEST m=+0.000120847
$ go version
go version go1.15 linux/amd64
$ go run main.go
2020-08-28 08:44:47.598714765 +0000 UTC m=+0.000071254

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/davidterranova/Library/Caches/go-build"
GOENV="/Users/davidterranova/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/davidterranova/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct
6478
"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/davidterranova/Documents/development/smallpdf/pro/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j_/6_9hdtls6tb_yvmfygpy54jm0000gn/T/go-build886013447=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

package main

import (
  "time""
  "fmt"
)

func main() {
  fmt.Println(time.Now())
}

Has different time precisions depending on the operating system it is being ran.

  • micro second precision on MacOS Catalina
  • nano second precision on linux
  • micro second on Windows

What did you expect to see?

Either the same time precision or the mention of these differences in the documentation of the package time

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0