package main import ( "fmt" "time" ) func main() { select { case <-time.Tick(2 * time.Second): fmt.Println("2 second over:", time.Now().Second()) case <-time.After(7 * time.Second): fmt.Println("5 second over, timeover", time.Now().Second()) return } }
请写出答案
举报
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|学习笔记
GMT+8, 2024-9-8 09:30 , Processed in 0.021587 second(s), 15 queries , APCu On.
Powered by Discuz! X3.5
© 2001-2024 Discuz! Team.