(Go)08.time示例

 

 

 1 package main
 2 
 3 
 4 import (
 5     "fmt"
 6     "time"
 7 )
 8 
 9 func test() {
10     time.Sleep(time.Millisecond*1000)
11 }
12 
13 func main() {
14     now := time.Now()
15     fmt.Println(now.Format("2006/1/02 15:04:05"))
16     
17     start := time.Now().UnixNano()
18     test()
19     end := time.Now().UnixNano()
20 
21     fmt.Printf("cost time:%d us\n", (end -start)/1000)
22 }

 

posted @ 2019-01-29 17:31  lvelvis  阅读(190)  评论(0编辑  收藏  举报
#####