go time模块

package main

import (
"fmt"
"time"
)

func test() {
time.Sleep(time.Millisecond * 100)
}

func main() {

now := time.Now()
fmt.Println(now.Format("2006/01/02 15:04:05"))

start := time.Now().UnixNano()
test()
end := time.Now().UnixNano()

fmt.Printf("cost:%d \n", (end-start)/1000)
}
posted @ 2018-03-23 10:54  梁伟雄的博客  阅读(222)  评论(0编辑  收藏  举报