当前位置:网站首页>ustime写出了bug
ustime写出了bug
2022-07-01 12:33:00 【涛歌依旧】
最近,写了一个ustime函数,不小心搞出了一个bug, 查了一下,修复了。
然后,我想,这函数应该很常见啊,于是在开源代码中搜了一下,果然有,来看看别人咋写:
/* Return the UNIX time in microseconds */
long long ustime(void) {
struct timeval tv;
long long ust;
gettimeofday(&tv, NULL);
ust = ((long long)tv.tv_sec)*1000000;
ust += tv.tv_usec;
return ust;
}
/* Return the UNIX time in milliseconds */
mstime_t mstime(void) {
return ustime()/1000;
}
经测试, OK, 这样清晰多了。
边栏推荐
- AI matting tool
- What are the PHP FPM configuration parameters
- [some notes]
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 3
- Indefinite integral
- Ansi/ul 94 VTM vertical burning test for thin materials
- 第十四章 信号(四)- 多进程任务示例
- 比特熊直播间一周年,英雄集结令!邀你来合影!
- fatal error: execution: 没有那个文件或目录
- 使用BurpSuite对app抓包教程
猜你喜欢

Typora adds watermarks to automatically uploaded pictures

Joint Time-Frequency and Time Domain Learning for Speech Enhancement
![[Suanli network] technological innovation of Suanli Network -- key technology of operation service](/img/80/6e3648c88d309516d4bc29db9c153c.jpg)
[Suanli network] technological innovation of Suanli Network -- key technology of operation service

【datawhale202206】pyTorch推荐系统:精排模型 DeepFM&DIN

Onenet Internet of things platform - mqtt product devices send messages to message queues MQ

队列的链式存储
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5](/img/f5/9c68b3dc30362d3776c262fdc13fd0.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5

【20211129】Jupyter Notebook遠程服務器配置

Onenet Internet of things platform - the console sends commands to mqtt product devices

【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE
随机推荐
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4
[brain opening] west tide and going to the world series
Indefinite integral
I wish you all a happy reunion
Relationship between accuracy factor (DOP) and covariance in GPS data (reference link)
Leetcode force buckle (Sword finger offer 31-35) 31 Stack push pop-up sequence 32i II. 3. Print binary tree from top to bottom 33 Post order traversal sequence 34 of binary search tree The path with a
Mysql database knowledge collation
Chapter 14 signals (IV) - examples of multi process tasks
循环链表--
[datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE
【MAUI】为 Label、Image 等控件添加点击事件
[20211129] configuration du serveur distant du carnet de notes jupyter
Ansible Playbook
Exploration and practice of inress in kubernetes
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 2
Wechat simulated geographical location_ Camouflage wechat location
【datawhale202206】pyTorch推荐系统:召回模型 DSSM&YoutubeDNN
Question d'entrevue de Huawei: recrutement
Typora adds watermarks to automatically uploaded pictures
[20211129] jupyter notebook remote server configuration