当前位置:网站首页>go写一个在一定时间内运行的程序
go写一个在一定时间内运行的程序
2022-07-07 05:27:00 【Jimmy_jimi】
目标:打印菱形
执行一个程序,使其在一定时间内一直执行
结果产出:
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")
}
边栏推荐
- Openjudge noi 2.1 1752: chicken and rabbit in the same cage
- 单场带货涨粉10万,农村主播竟将男装卖爆单?
- Zcmu--1396: queue problem (2)
- AVL平衡二叉搜索树
- Go语言中,函数是一种类型
- 【雅思口语】安娜口语学习记录 Part2
- 打通法律服务群众“最后一公里”,方正璞华劳动人事法律自助咨询服务平台频获“点赞”
- Zcmu--1492: problem d (C language)
- Practice of combining rook CEPH and rainbow, a cloud native storage solution
- Vulnerability recurrence easy_ tornado
猜你喜欢

Famine cloud service management script

Opencv learning note 5 - gradient calculation / edge detection

Installation and configuration of PLSQL

Réplication de vulnérabilité - désrialisation fastjson

使用BiSeNet实现自己的数据集

Rainbond 5.7.1 支持对接多家公有云和集群异常报警

Ebpf cilium practice (2) - underlying network observability

Input of mathematical formula of obsidan

在 Rainbond 中一键安装高可用 Nacos 集群

在Rainbond中实现数据库结构自动化升级
随机推荐
XCiT学习笔记
归并排序和非比较排序
Rainbond 5.6 版本发布,增加多种安装方式,优化拓扑图操作体验
Splunk中single value视图使用将数值替换为文字
云原生存储解决方案Rook-Ceph与Rainbond结合的实践
使用SwinUnet训练自己的数据集
Xcit learning notes
Rainbond 5.7.1 支持对接多家公有云和集群异常报警
Several ways of lambda used in functions in kotlin (higher-order functions)
Lua 编程学习笔记
使用BiSeNet实现自己的数据集
MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
下载和安装orcale database11.2.0.4
【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
The truth of robot education in hands-on practice
opencv学习笔记四——膨胀/腐蚀/开运算/闭运算
IELTS review progress and method use [daily revision]
拓维信息使用 Rainbond 的云原生落地实践
MES系統,是企業生產的必要選擇