mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
20 lines
312 B
Go
20 lines
312 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/gogf/gf/os/gtimer"
|
|
)
|
|
|
|
func main() {
|
|
now := time.Now()
|
|
interval := 510 * time.Millisecond
|
|
gtimer.Add(interval, func() {
|
|
fmt.Println(time.Now(), time.Duration(time.Now().UnixNano()-now.UnixNano()))
|
|
now = time.Now()
|
|
})
|
|
time.Sleep(time.Hour)
|
|
select {}
|
|
}
|