当前位置:网站首页>Ustime wrote a bug
Ustime wrote a bug
2022-07-01 12:41:00 【Tao song remains the same】
lately , Wrote a ustime function , Accidentally made a bug, Checked the , Repair the .
then , I think , This function should be very common , So I searched the open source code , Sure enough , Come and see what others write :
/* 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;
}
After testing , OK, It's much clearer .
边栏推荐
- Interpretation of hard threshold function [easy to understand]
- leetcode:241. 为运算表达式设计优先级【dfs + eval】
- [datawhale202206] pytorch recommendation system: recall model DSSM & youtubednn
- 第十四章 信号(四)- 多进程任务示例
- 6.30模拟赛总结
- 【脑洞大开】《西潮》及《走向世界丛书》
- redis探索之缓存击穿、缓存雪崩、缓存穿透
- 【历史上的今天】7 月 1 日:分时系统之父诞生;支付宝推出条码支付;世界上第一支电视广告
- ASTM D 3801 vertical burning test of solid plastics
- MySQL workbench data modeling function
猜你喜欢
What are the PHP FPM configuration parameters
Chapter 14 signals (IV) - examples of multi process tasks
leetcode:226. 翻转二叉树【dfs翻转】
leetcode:329. The longest incremental path in the matrix [DFS + cache + no backtracking + elegance]
2022-06-28-06-29
Manage nodejs with NVM (downgrade the high version to the low version)
logstash报错:Cannot reload pipeline, because the existing pipeline is not reloadable
[speech signal processing] 3 speech signal visualization -- prosody
【历史上的今天】7 月 1 日:分时系统之父诞生;支付宝推出条码支付;世界上第一支电视广告
基于开源流批一体数据同步引擎 ChunJun 数据还原 —DDL 解析模块的实战分享
随机推荐
Share several tools for designing exquisite circuit diagrams
Arm GIC (V) how arm TrustZone supports security interrupt analysis notes.
Like the three foot platform
腾讯总考epoll, 很烦
Friends day 2022
Logstash error: cannot reload pipeline, because the existing pipeline is not reloadable
网络socket的状态要怎么统计?
Nc100 converts strings to integers (ATOI)
工具箱之 IKVM.NET 项目新进展
从数据库中更新一条数据,用cdc会同时获得op字段分别为d和c的两条数据吗?我记得之前是只有op为u
leetcode:241. Design priority for operation expression [DFS + Eval]
ANSI/UL 94 VTM薄质材料垂直燃烧测试
leetcode:329. 矩阵中的最长递增路径【dfs + cache + 无需回溯 + 优雅】
【脑洞大开】《西潮》及《走向世界丛书》
VS Code 设置单击打开新文件窗口,不覆盖前一个窗口
Ansi/ul 94 VTM vertical burning test for thin materials
微信模拟地理位置_伪装微信地理位置
使用nvm管理nodejs(把高版本降级为低版本)
The difference between memcpy and strcpy
2022-06-28-06-29