package main
import ( "time" "math")
func main() { datetime := time.Now().Add(time.Hour * 24 * 7 * 4 * 12 * 3) seconds := -1 * int(time.Now().Sub(datetime).Seconds()) a := 29030400 b := float64(seconds) / float64(a)
println("input:", b) println("floor:", math.Floor(b))}
input: +3.000000e+000floor: +2.000000e+000
input: +3.000000e+000floor: +3.000000e+000
go version go1.10.2 linux/amd64GOARCH="amd64"GOBIN=""GOCACHE="/home/msd/.cache/go-build"GOEXE=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOOS="linux"GOPATH="/home/msd/go/"GORACE=""GOROOT="/usr/local/go"GOTMPDIR=""GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"GCCGO="gccgo"CC="gcc"CXX="g++"CGO_ENABLED="1"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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build304261270=/tmp/go-build -gno-record-gcc-switches"GOROOT/bin/go version: go version go1.10.2 linux/amd64GOROOT/bin/go tool compile -V: compile version go1.10.2uname -sr: Linux 4.13.0-37-genericDistributor ID: UbuntuDescription: Ubuntu 16.04.4 LTSRelease: 16.04Codename: xenial/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu10) stable release version 2.23, by Roland McGrath et al.gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
But I don't think it is because Windows is so much faster than Linux
and/or the way the time package implemented is different between Windows and Linux
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
package main
import ( "time" "math"
"fmt")
func main() { now := time.Now()
datetime := now.Add(time.Hour * 24 * 7 * 4 * 12 * 3) seconds := -1 * int(now.Sub(datetime).Seconds()) a := 29030400 x := float64(seconds)/float64(a)
fmt.Println("input:", x, "floor:", math.Floor(x))}