当前位置:网站首页>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 */
边栏推荐
- SaaS cloud tool, a sharp tool for change under the industrial Internet
- 513. Find Bottom Left Tree Value
- Advanced development - generic entry basic class test
- Thread pool
- Object
- R语言ggplot2可视化水平箱图(Horizontal boxplot with coord_flip)、并添加抖动数据点显示分布情况(jittered points)
- Interpreting the 2022 agile coaching industry status report
- Image reading: image open(ImgPath)
- Matlab: how to know from some data which data are added to get a known number
- 再突破!阿里云进入Gartner云AI开发者服务挑战者象限
猜你喜欢

Server deployment and instructions

【TcaplusDB知识库】TcaplusDB新增机型介绍

Golang对JSON文件的写操作

【解决】npm WARN config global `--global`, `--local` are deprecated. Use `--location=global`

npm install 问题解决(nvm安装与使用)
![[tcapulusdb knowledge base] Introduction to tmonitor system upgrade](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] Introduction to tmonitor system upgrade

Detailed explanation of MQ message oriented middleware theory

Ten thousand words introduction, detailed explanation of the core technical points of Tencent interview (t1-t9), and arrangement of interview questions
![Generating binary search balanced tree [using tree recursion]](/img/b3/f8edf45bdfdced7c3698088dbf7d84.png)
Generating binary search balanced tree [using tree recursion]
NLP 论文领读|改善意图识别的语义表示:有监督预训练中的各向同性正则化方法
随机推荐
MATLAB中iscellstr函数的使用
怎样快速的应对变动的生产管理需求?
Readimg: read picture to variable variable variable
Apache commons tool class
港股多支个股表现活跃,引发投资者对港股市场回暖猜想与关注
Quartz
ABP框架之——数据访问基础架构(下)
【TcaplusDB知识库】Tmonitor后台一键安装介绍(一)
SaaS 云工具,产业互联网下的变革利器
npm 如何发包 删包
《ThreadLocal》
提高效率 Or 增加成本,开发人员应如何理解结对编程?
SaaS cloud tool, a sharp tool for change under the industrial Internet
If no code is moved, the project access speed drops significantly the next day. Case analysis
What are the risks of opening a fund account? Is it safe to open an account
openGauss数据库源码解析系列文章—— 密态等值查询技术详解(下)
总结一下购买阿里云服务器的经验
VGg download (.Net file and imagenet-vgg-verydeep-19)
ADB 按键名、按键代码数字、按键说明对照表
OutputDebugString使用说明以及异常处理