Golang的time.Unix()函数可能存在的一个BUG

前端之家收集整理的这篇文章主要介绍了Golang的time.Unix()函数可能存在的一个BUG前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
fmt.Printf("math.MaxInt64totime.Unix=[%s]\n",time.Unix(math.MaxInt64,0))
fmt.Printf("math.MaxInt64/10totime.Unix=[%s]\n",time.Unix(math.MaxInt64/10,0))
fmt.Printf("math.MaxInt64/100totime.Unix=[%s]\n",time.Unix(math.MaxInt64/100,0))
fmt.Printf("math.MaxInt64/1000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/1000,0))
fmt.Printf("math.MaxInt64/10000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/10000,0))
fmt.Printf("math.MaxInt64/100000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/100000,0))
fmt.Printf("math.MaxInt64/1000000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/1000000,0))
fmt.Printf("math.MaxInt64/10000000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/10000000,0))
fmt.Printf("math.MaxInt64/100000000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/100000000,0))
fmt.Printf("math.MaxInt64/1000000000totime.Unix=[%s]\n",time.Unix(math.MaxInt64/1000000000,0))

执行结果如下:

math.MaxInt64 to time.Unix=[219250468-12-04 23:30:07 +0800 CST]

math.MaxInt64/10 to time.Unix=[-837066640-09-10 09:33:00 +0800 CST]

math.MaxInt64/100 to time.Unix=[-1372195080-04-09 08:09:18 +0800 CST]

math.MaxInt64/1000 to time.Unix=[292278994-08-17 15:12:55 +0800 CST]

math.MaxInt64/10000 to time.Unix=[29229672-06-18 01:31:17 +0800 CST]

math.MaxInt64/100000 to time.Unix=[2924740-04-01 00:09:07 +0800 CST]

math.MaxInt64/1000000 to time.Unix=[294247-01-10 12:00:54 +0800 CST]

math.MaxInt64/10000000 to time.Unix=[31197-09-14 10:48:05 +0800 CST]

math.MaxInt64/100000000 to time.Unix=[4892-10-08 05:52:48 +0800 CST]

math.MaxInt64/1000000000 to time.Unix=[2262-04-12 07:47:16 +0800 CST]

原文链接:https://www.f2er.com/go/191020.html

猜你在找的Go相关文章