当前位置:网站首页>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, 这样清晰多了。
边栏推荐
- 手机便签应用
- 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/
- ASTM D 3801 vertical burning test of solid plastics
- MySQL的零拷贝技术
- 【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE
- What are the PHP FPM configuration parameters
- (混更一篇)多个txt文本转一个表格
- Using burpsuite to capture app packages
- [some notes]
- "Analysis of 43 cases of MATLAB neural network": Chapter 40 research on prediction of dynamic neural network time series -- implementation of NARX based on MATLAB
猜你喜欢

栈-------

How to install php7 and perform performance test using yum

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

Common chart usage of Bi tools

【脑洞大开】《西潮》及《走向世界丛书》

Machine learning - Data Science Library - day two

Onenet Internet of things platform - mqtt product equipment upload data points

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

Chained storage of queues

MySQL common functions
随机推荐
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7
数字信号处理——线性相位型(Ⅱ、Ⅳ型)FIR滤波器设计(2)
Efforts at the turn of the decade
Self organization is the two-way rush of managers and members
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 8
VS Code 设置代码自动保存
【MAUI】为 Label、Image 等控件添加点击事件
Exploration and practice of inress in kubernetes
栈-------
GID: open vision proposes a comprehensive detection model knowledge distillation | CVPR 2021
[Suanli network] technological innovation of Suanli Network -- key technology of operation service
QT 播放器之列表[通俗易懂]
Typora adds watermarks to automatically uploaded pictures
Compile and debug net6 source code
Pandas reads MySQL data
MySQL workbench data modeling function
華為面試題: 招聘
【20211129】Jupyter Notebook遠程服務器配置
栈的应用——括号匹配问题
【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE