当前位置:网站首页>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, 这样清晰多了。
边栏推荐
- fatal error: execution: 没有那个文件或目录
- Eurake partition understanding
- Build yocto system offline for i.mx8mmini development board
- AI matting tool
- Circular linked list--
- [datawhale202206] pytorch recommendation system: multi task learning esmm & MMOE
- Huawei interview question: Recruitment
- Wechat applet reports an error: [rendering layer network layer error] pages/main/main Local resource pictures in wxss cannot be obtained through wxss. You can use network pictures, Base64, or < image/
- 【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE
- 硬阈值(Hard Thresholding)函数解读[通俗易懂]
猜你喜欢
The operation process of using sugar to make a large data visualization screen
2022-06-28-06-29
Typora adds watermarks to automatically uploaded pictures
[some notes]
Arm GIC (V) how arm TrustZone supports security interrupt analysis notes.
MySQL common functions
本科毕业四年:工作,辞职,结婚,买房
VS Code 设置单击打开新文件窗口,不覆盖前一个窗口
Technology sharing | MySQL: how about copying half a transaction from the database?
队列的链式存储
随机推荐
顺序表有关操作
Stack-------
Eurake分区理解
Technology sharing | MySQL: how about copying half a transaction from the database?
Teach you to complete the actual battle of image classification hand in hand -- Image Recognition Based on convolutional neural network
Machine learning - Data Science Library Day 3 - Notes
CPI tutorial - asynchronous interface creation and use
Like the three foot platform
强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
Ansible的playbook
MySQL workbench data modeling function
(mixed version 1) multiple TXT text to one table
Consolidate -c operator
JPA and criteria API - select only specific columns - JPA & criteria API - select only specific columns
本科毕业四年:工作,辞职,结婚,买房
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 3
華為面試題: 招聘
Tencent Li Wei: deeply cultivate "regulatory technology" to escort the steady and long-term development of the digital economy
系统测试UI测试总结与问题(面试)
Queue operation---