当前位置:网站首页>Go write a program that runs within a certain period of time

Go write a program that runs within a certain period of time

2022-07-07 08:32:00 Jimmy_ jimi

The goal is : Print diamond

Execute a program , Keep it running for a certain period of time


Result output :

func main()  {
    
	go  log.Log2("1","1","1")
	start :=time.Now()
	time.Sleep(10*time.Millisecond)
	fmt.Println(time.Since(start).Milliseconds())
	re:
		for  {
    
			fmt.Println(int(time.Since(start).Milliseconds()))
			if int(time.Since(start).Milliseconds())>1000{
    
				break  re
			}

		}

	for int(time.Since(start).Milliseconds())>1000{
    

	}
	fmt.Println("2")
}
原网站

版权声明
本文为[Jimmy_ jimi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070526597316.html