摘要:

以ms为单位,获取系统时间、睡眠或延迟时间函数的使用方法。

 #include<stdio.h>
 #include <time.h>
 #include <sys/time.h>
 #include <unistd.h>

 typedef unsigned int uint32_t;
 #define csp_sleep_ms(time_ms) usleep(time_ms * 1000);

 uint32_t csp_get_ms() {
     struct timespec ts;

     ) {
         +ts.tv_nsec/);
     } else {
         ;
     }
 }

 int main()
 {
     uint32_t start = csp_get_ms();
     csp_sleep_ms();
     uint32_t time = csp_get_ms()-start;
     printf(" Reply in %u ms\r\n", time);
     ;
 }

重要函数说明:

参加百度百科:https://baike.baidu.com/item/clock_gettime

%u:表示无符号十进制整数。

最新文章

  1. 虚拟机VMware12.05下安装Ubuntu16.04几个关键地方
  2. WCF传输1-你是否使用过压缩或Json序列化?
  3. Spark MLib 基本统计汇总 2
  4. 深入剖析Java中的装箱和拆箱
  5. 读《C# 和 Java 的比较》有感
  6. C++ Primer 有感(异常处理)
  7. Vue 项目实战系列 (二)
  8. 简单购物车程序(Python)
  9. debian8下acme nginx 部署记录
  10. CSS实现水平垂直居中的1010种方式
  11. vuejs2.0与1.x版本中怎样使用js实时访问input的值的变化
  12. Js 常用字符串操作 API
  13. @ResponseBody注解
  14. springboot nginx 配置
  15. 第一章02: 常用的DOS命令
  16. 【洛谷P1638】逛画展
  17. 【转】asp.net项目在IE11下出现“__doPostBack”未定义的解决办法
  18. OpenHaptics编程环境搭建
  19. Django基于正则表达式的URL(2)
  20. elastic search internal

热门文章

  1. 精通CSS:高级WEB解决方案
  2. mysql:创建新库,新表,查看character
  3. The second day of Crawler learning
  4. 急速搭建 Serverless AI 应用:为你写诗
  5. Python 多态与抽象类
  6. $HDU$ 4352 ${XHXJ}&#39;s LIS$ 数位$dp$
  7. 为什么TCP建立连接协议是三次握手,而关闭连接却是四次握手呢?
  8. VMware 完成 27 亿美元的 Pivotal 收购 | 云原生生态周报 Vol. 34
  9. 【原创】快速失败机制&amp;失败安全机制
  10. graphviz 的使用教程