Gcc 中的 gettimeofday 函数使用
来源:互联网 发布:男朋友宠我知乎 编辑:程序博客网 时间:2024/06/14 04:16
gettimeofday
表头文件:#include <sys/time.h>
函数原型:int gettimeofday(struct timeval *tv,struct timezone *tz)
函数说明:把目前的时间按tv所指的结构返回,当时地区的信息则放到tz所指的结构中
struct timeval
{
long tv_sec; //秒
long tv_usec;//微妙
}
struct timezone
{
int tz_minuteswest;//和格林威治时间差了多少分钟
int tz_dsttime; //日光节约时间的状态
}
学习代码
#include <stdio.h>#include <sys/time.h>int main(int argc, char** argv){ timeval tv; gettimeofday(&tv, NULL); double cl = tv.tv_sec + (double)tv.tv_usec / 1000000; getchar(); //暂停等待 gettimeofday(&tv, NULL); cl = (tv.tv_sec + (double)tv.tv_usec / 1000000) - cl; printf("暂停时间:%f\n", cl); struct timezone tz; gettimeofday(&tv, &tz); printf("tv.tv_sec:%d\n", tv.tv_sec); printf("tv.tv_usec:%d\n", tv.tv_usec); printf("tz.tz_minuteswest:%d\n", tz.tz_minuteswest); printf("tv.tz_dsttime:%d\n", tz.tz_dsttime); return 0;}
- Gcc 中的 gettimeofday 函数使用
- Gcc 中的 gettimeofday 函数使用
- gettimeofday函数使用《代码》
- Linux 中的计时——gettimeofday函数
- Linux 中的计时——gettimeofday函数
- Linux 中的计时——gettimeofday函数
- Linux 中的计时——gettimeofday函数
- Linux 中的计时——gettimeofday函数
- Linux 中的计时——gettimeofday函数
- Linux 中的计时——gettimeofday函数
- gettimeofday函数
- gettimeofday 函数
- 关于gettimeofday函数的使用问题
- Windows下直接使用gettimeofday函数
- gettimeofday使用
- C语言函数gettimeofday
- gettimeofday()函数的使用方法
- gettimeofday()函数的使用方法:
- 2012年度最佳短篇小说
- C# WinForm开发系列 - WebBrowser
- NoSQL数据库笔谈
- 运放的参数和选择
- 浅谈如何学习加密与解密技术
- Gcc 中的 gettimeofday 函数使用
- MyEclipse中删除Struts应用的问题:删掉struts部分
- 单兵种兵例胜残局
- .net 代码混淆原理性实践
- A couple of notes about Z
- 实训第一天
- hdu 2925
- Js事件大全 javascript事件大全
- Mathematics for Computer Graphics数学在计算机图形学中的应用