文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>c中的时间处理函数

c中的时间处理函数

时间:2010-05-13  来源:asteriskchina

在asterisk中有很多时间处理函数,能让你很轻松就能完成对时间的定制操作。
#include "time.h"
#include "stdio.h"
#define DATE_FORMAT "%Y-%m-%d %T"
int main(void)
{

 struct tm *ptr;
 time_t lt;
 char str[80];
 time(&lt);
 ptr=localtime(&lt); //取得当地时间
 strftime(str,100,DATE_FORMAT,ptr); //类似于snprintf函数,定制格式。
 printf(str);
 return 0;

}
计算程序运行了多久,单位秒
time_t end_time, answer_time = time(NULL);
time(&end_time);
long int runtime;
runtime = (long)(end_time - answer_time);
相关阅读 更多 +
排行榜 更多 +
打螺丝高手

打螺丝高手

模拟经营 下载
解救火柴人计划安卓版

解救火柴人计划安卓版

体育竞技 下载
鸡生化精英安卓版

鸡生化精英安卓版

飞行射击 下载