winows平台下:
代码如下
#include <time.h>
#include <stdio.h>
#include <windows.h>//使用sleep需要这个头文件
int main(int argc, char **argv)
{
double cost;//时间差
time_t tmpcal_ptr1;
time_t tmpcal_ptr2;
struct tm *tmp_ptr = NULL;
time(&tmpcal_ptr1);
Sleep(1000);//延时一秒
time(&tmpcal_ptr2);
tmp_ptr = localtime(&tmpcal_ptr1);//转换成当地时间
printf (