struct timeval结构体 以及 gettimeofday()函数
来源:互联网 发布:手机温度测试软件 编辑:程序博客网 时间:2024/05/20 09:43
关于 struct timeval
struct timeval{ __time_t tv_sec;/*Seconds.*/ __suseconds_t tv_usec;/*Miceoseconds.*/};其中tv_sec是Epoch到创建结构体timeval的秒数,tv_usec为微秒数,也就是秒数后面的零头,下面做一个实验
#include<cstdio>#include<windows.h>./Sleep#include<sys/time.h>#include<iostream>using namespace std;int main(){ struct timeval tv; for(int i=0; i<5; ++i) { gettimeofday(&tv,NULL); printf("%d\t%d\n",tv.tv_usec,tv.tv_sec); Sleep(1000);//线程休眠一秒 } return 0;}
关于gettimeofday()函数:
gettimeofday()功能是得到当前时间和时区,分别写到tv和tz中,如果tz为NULL则不向tz写入。
阅读全文
0 0
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- struct timeval结构体 以及 gettimeofday()函数
- 有关struct timeval结构体 以及 gettimeofday()函数
- 十七 struct timeval结构体 以及 gettimeofday()函数
- linux系统中struct timeval结构体、struct timezone结构体以及gettimeofday函数
- struct timeval结构体
- struct timeval结构体
- struct timeval结构体
- 深度学习网
- 【CC2640R2F】利用CCS在macOS下搭建CC2640R2F蓝牙5.0开发环境
- Mybatis中的resultType和resultMap的区别
- jsp:找不到javabean与404
- eclipse黑色主题
- struct timeval结构体 以及 gettimeofday()函数
- Java 异常 异常链
- sql 错误 未更新行1中的数据 错误源:.net sqlclient data provider
- 33.mysql 开发技巧
- 数据压缩实验三--Huffman编解码及压缩率的比较
- MySQL带关系运算符的查询
- 【Spring Cloud学习】 搭建简单的服务注册中心Spring cloud Eureka
- Mac环境安装、配置centos Linux
- git修改用户名和邮箱