当前位置:网站首页>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, 这样清晰多了。
边栏推荐
- Machine learning - Data Science Library - day two
- Compile and debug net6 source code
- VS Code 设置单击打开新文件窗口,不覆盖前一个窗口
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 3
- Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
- Joint Time-Frequency and Time Domain Learning for Speech Enhancement
- USB peripheral driver - cable connect/disconnect
- LeetCode力扣(剑指offer 31-35)31. 栈的压入弹出序列32I.II.III.从上到下打印二叉树33. 二叉搜索树的后序遍历序列34. 二叉树中和为某一值的路径35. 复杂链表的复制
- redis探索之缓存击穿、缓存雪崩、缓存穿透
- Wechat applet - 80 practical examples of wechat applet projects
猜你喜欢

Joint Time-Frequency and Time Domain Learning for Speech Enhancement
![[Yunju entrepreneurial foundation notes] Chapter VII Entrepreneurial Resource test 1](/img/be/1194125442aaa2d7cc20b6a4a6762a.jpg)
[Yunju entrepreneurial foundation notes] Chapter VII Entrepreneurial Resource test 1

What are the PHP FPM configuration parameters

【语音信号处理】3语音信号可视化——prosody

Virtualenv+pipenv virtual environment management
![[datawhale202206] pytorch recommendation system: precision model deepfm & DIN](/img/4f/8799016731a2c1647b6f2f4d96b754.png)
[datawhale202206] pytorch recommendation system: precision model deepfm & DIN

91.(cesium篇)cesium火箭發射模擬

Ansible相关内容梳理

【20211129】Jupyter Notebook远程服务器配置

Message queue monitoring refund task batch process
随机推荐
编译调试Net6源码
redis探索之缓存击穿、缓存雪崩、缓存穿透
Typora adds watermarks to automatically uploaded pictures
微信模拟地理位置_伪装微信地理位置
Pandas reads MySQL data
第十四章 信号(四)- 多进程任务示例
LeetCode 454. Add four numbers II
JS reverse | m3u8 data decryption of a spring and autumn network
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8
List of QT players [easy to understand]
MySQL的零拷贝技术
Like the three foot platform
One year anniversary of bitbear live studio, hero rally order! I invite you to take a group photo!
How to use opcache, an optimization acceleration component of PHP
Exploration and practice of inress in kubernetes
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5
腾讯安全发布《BOT管理白皮书》|解读BOT攻击,探索防护之道
比特熊直播间一周年,英雄集结令!邀你来合影!
[JS advanced] promise explanation
JPA and criteria API - select only specific columns - JPA & criteria API - select only specific columns