C++语言 之 标准库函数(4)

 标准C时间和日期函数

1、asctime():时间文本格式

#include <time.h>

Char *asctime(const struct tm *ptr);

 

2、Clock():返回自程序开始运行所经过的时间

#include <time.h>

Clock_t clock(void);

 

3、Ctime():返回特定格式时间

#include<time.h>

Char *ctime(onst time_t *time);

 

4、Difftime():两个时刻的间隔

#include <time.h>

Double difftime(time_t time2, time_t time1);

 

5、Gmtime():返回指向当前格林威治时间的指针

#include <time.h>

Struct tm *gmtime(const time_t *time);

 

6、Localtime():返回指向当前时间的指针

#include <time.h>

Struct tm *localtime(const time_t *time);

 

7、Mktime():返回指定时间的日历格式

#include <time.h>

Time_t mktime(struct tm *time);

 

8、Strftime():返回日期和时间的单个元素

#include <time.h>

Size_t strftime(char *str, size_t maxsize, const char *fmt, struct tm *time);

 

9、Time():返回系统的当前日历时间

#include <time.h>

Time_t time(time_t *time);

 

 

 

猜你喜欢

转载自www.cnblogs.com/Miraclesl/p/9182033.html