struct timeval{
long int tv_sec; // 秒数 同time(NULL) 的返回值
long int tv_usec; // 微秒数 10 的6次方
};
 struct timezone{
int tz_minuteswest;/*格林威治时间往西方的时差*/
int tz_dsttime;/*DST 时间的修正方式*/
};
 #include <stdio.h>
#include <sys/time.h> int main()
{
struct timeval tv;
struct timezone tz; int res = gettimeofday(&tv, &tz);
printf("res = %d\n", res);
printf("tv.tv_sec = %ld, tv.tv_usec = %ld\n",
tv.tv_sec, tv.tv_usec); return ;
}

gettimeofday() 获取系统时间,精确到微秒 这个似乎只能在linux 下用,不能在windows 下用的更多相关文章

  1. redis获取当前时间精确到微秒

    在redis取得当前时的方法为执行time命令 127.0.0.1:6382> time1) "1495780564"2) "894089" 第一行为以 ...

  2. VC++ 获取系统时间、程序运行时间(精确到秒,毫秒)的五种方法

    1.使用CTime类(获取系统当前时间,精确到秒) CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime();//获取系统日期 str=tm ...

  3. 【VS开发】VC++ 获取系统时间、程序运行时间(精确到秒,毫秒)的五种方法

    1.使用CTime类(获取系统当前时间,精确到秒) CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime();//获取系统日期 str=tm ...

  4. 【转】cocos2d-x获取系统时间——2013-08-25 10

    欢迎转载,本帖地址:http://blog.csdn.net/jinjian2009/article/details/9449585 之前使用过cocos2d-x获取系统时间,毫秒级的 long ge ...

  5. cocos2d-x获取系统时间

    欢迎转载,本帖地址:http://blog.csdn.net/jinjian2009/article/details/9449585 之前使用过cocos2d-x获取系统时间,毫秒级的 long ge ...

  6. C/C++ 获取系统时间 到秒 || 到毫秒

    string getNowSysTime(string &outPut) { ] = {}; struct timeval tv; struct timezone tz; struct tm ...

  7. (C/C++学习)12.获取系统时间制作时钟(system()略解)

    说明:通过调用函数来获取系统当前时间,并制作一个数字式的时钟,时钟的显示包括年.月.日.小时.分以及秒,通过系统屏幕的刷新来对不断更新的时间进行屏幕的显示. 一.对相关函数的学习 1.time_t t ...

  8. cocos2d-x 获取系统时间

    转自:http://blog.csdn.net/jinjian2009/article/details/9449585 之前使用过cocos2d-x获取系统时间,毫秒级的 long getCurren ...

  9. C++11新特性,利用std::chrono精简传统获取系统时间的方法

    一.传统的获取系统时间的方法 传统的C++获取时间的方法须要分平台来定义. 相信百度代码也不少. 我自己写了下,例如以下. const std::string getCurrentSystemTime ...

随机推荐

  1. python tornado框架使用

    处理方法 t_handler.py from tornado.web import RequestHandler class IndexHandler(RequestHandler): def get ...

  2. 市委组织部考核项目——利用EasyUi中可编辑的DataGrid控件对多行数据进行编辑并提交

    http://blog.csdn.net/cjr15233661143/article/details/19041165 市委组织部考核项目中需要录入原始数据,拿开发区的数据录入举例说明,见下图,需要 ...

  3. 用JavaScript往DIV动态添加内容

    参考:http://zhidao.baidu.com/link?url=6jSchyqPiEYCBoKdOmv52YHz9r7MTBms2pK1N6ptOX1kaR2eg320mlW1Sr6n36hp ...

  4. wikioi 1075 明明的随机数

    /*============================================================ 1075 明明的随机数 题目描述 Description 明明想在学校中请 ...

  5. Mdrill:来自阿里的多维快速查询工具

    mdrill是阿里妈妈-adhoc-海量数据多维自助即席查询平台下的一个子项目.旨在帮助用户在几秒到几十秒的时间内,分析百亿级别的任意维度组合的数据.mdrill是一个分布式的在线分析查询系统,基于h ...

  6. 【Reporting Services 报表开发】— 数据表的使用

    一.打开 SQL Server Business Intelligence Development Studio,新建项目—>商业智能项目—> 报表服务器项目,命名为CH3 二.在报表文件 ...

  7. ORA-27086: unable to lock file - already in use

    问题现象: SQL> startup ORACLE instance started. Total System Global Area 1854021632 bytes Fixed Size  ...

  8. ajax同步,异步

    传输数据 同步:第一条传过去,对方接收到反馈以后,再传第二条; 异步:第一条传过去,不管对方有没有收到,继续传第二条. ajax(默认异步 async:true) 同步:执行完ajax内部代码,才执行 ...

  9. Panel扩展 圆角边框,弧形边框

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  10. Angular学习(5)- 数组双向梆定+filter

    示例: <!DOCTYPE html> <html ng-app="MyApp"> <head> <title>Study 5< ...