当前位置:网站首页>Code examples of golang goroutine, channel and time
Code examples of golang goroutine, channel and time
2022-06-23 16:23:00 【Learn programming notes】
golang goroutine、channel、time Code example
package main
import (
"time"
"fmt"
)
func timenow(ch chan string) {
tn := time.Now().Format("2006 year 01 month 02 Japan 15 spot 04 branch 05 second .0000000 The time zone -0700")
ch <-tn
}
func main (){
ch:=make(chan string)
for i:=0;i<10;i++ {
go timenow(ch)
fmt.Println(<-ch)
time.Sleep(500*time.Millisecond)
}
}
/* ################ Running results ################## PS D:\golang\github\golang_project\go Implementation cases demo\goroutine、channel、time Example > go run .\goroutine+channel+time.go 2020 year 08 month 10 Japan 10 spot 19 branch 27 second .2609770 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 27 second .7786030 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 28 second .2792588 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 28 second .7794479 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 29 second .2805396 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 29 second .7809675 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 30 second .2814328 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 30 second .7820869 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 31 second .2829391 The time zone +0800 2020 year 08 month 10 Japan 10 spot 19 branch 31 second .7834190 The time zone +0800 */
边栏推荐
- 港股多支个股表现活跃,引发投资者对港股市场回暖猜想与关注
- 线上交流丨可信机器学习之机器学习与知识推理相结合(青源Talk第20期 李博)
- Apple iPhone, Samsung mobile phone and other electronic products began to enter Russia through parallel import channels
- 多年亿级流量下的高并发经验总结,都毫无保留地写在了这本书中
- R语言plotly可视化:plotly可视化在对比条形图中添加误差条(Bar Chart with Error Bars with plotly in R)
- [tcapulusdb knowledge base] Introduction to new models of tcapulusdb
- Understand the classic buck-boost negative voltage circuit
- 【TcaplusDB知识库】Tmonitor后台一键安装介绍(一)
- Leetcode 450. Delete node in binary search tree
- Golang对JSON文件的写操作
猜你喜欢
随机推荐
window远程桌面连接互传文件加速小技巧
融云:让银行轻松上“云”
openGauss数据库源码解析系列文章—— 密态等值查询技术详解(上)
Can the hbuilderx light theme be annotated?
【TcaplusDB知识库】Tmonitor后台一键安装介绍(二)
A tour of grpc:01 - Basic Theory
513. Find Bottom Left Tree Value
Zhongda face sketch FERET database (cufsf)
Golang对JSON文件的写操作
2022九峰小学(光谷第二十一小学)生源摸底
How to configure PostgreSQL data source on SSRs page
PageHelper faces the paging problem of complex service data processing
What are the risks of opening a fund account? Is it safe to open an account
Batch registration component
Image saving: torchvision utils. save_ image(img, imgPath)
R语言使用gt包和gtExtras包优雅地、漂亮地显示表格数据:gtExtras包的gt_sparkline函数以表格的形式可视化分组数据的线图(line plot)、包含分组类别、分组类别对应的数值
leetcode:30. 串联所有单词的子串【Counter匹配 + 剪枝】
golang gob实现网络数据的传输
ADB 按鍵名、按鍵代碼數字、按鍵說明對照錶
Object







![[tcapulusdb knowledge base] Introduction to new models of tcapulusdb](/img/2a/1d7f12c99b92d143e142ade8bc90f9.png)
