Time default string format

 for {
    t := time.Now()

    fmt.Printf("%s\n", t)
    time.Sleep(1 * time.Second)
} 

output like
2017-09-10 17:37:50.53011 +0800 CST m=+0.001002600

2017-09-10 17:37:51.5331888 +0800 CST m=+1.004081400

2017-09-10 17:37:57.5359402 +0800 CST m=+7.006832800

2017-09-10 17:37:58.536241 +0800 CST m=+8.007133600

2017-09-10 17:37:59.5363434 +0800 CST m=+9.007236000

don’t know why , output line 1,and line 4, 53011,536241,len=5
other line , len=7

Trailing zeroes are not printed. If we did, a time would often look like “… 11:22:33.000000000” when it has seconds precision only.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.