c语言summary函数用法,c语言时间日期函数总结(C language time and date function summary).doc...

c语言时间日期函数总结(C language time and date function summary)

c语言时间日期函数总结(C language time and date function summary)

C language time and date function summary

Data structure used:

Time_t is a long type that represents machine time and can be obtained by the time () function.

The calendar time is represented by a (char *) type string. Format: week, month, day, hour: Minutes: seconds, years, \n\0

May be obtained by the function CTime () asctime ().

The temporal structure defined by the TM structure is defined as follows tm:

Struct TM {can be obtained by the function Localtime (), gmtime ()

Int tm_sec;

Int tm_min;

Int tm_hour;

Int tm_mday;

Int tm_mon;

Int tm_year;

Int tm_wday;

Int tm_yday;

Int tm_isdst;};

/ / system date

Struct date {

Int da_year; / * * / Year - 1980

Char da_day Day of the month; / * * /

Char da_mon Month (Jan = 1; / * * /});

Time / system

Struct time {

Unsigned char ti_min; / * * / Minutes

Unsigned char ti_hour; / * * / Hours

Unsigned char ti_hund Hundredths of seconds; / * * /

Unsigned char ti_sec Seconds; / * * /};

Function used:

Char * asctime (struct TM * PTR) converts the time of the TM structure to the calendar time.

Char *ctime (long time) converts machine time into calendar time.

Struct TM *gmtime (time_t *time) converts machine time into TM time

When the PTR is empty, the machine time is obtained; the machine time is set at non empty time.

Time_t time (time_t *ptr) gets or sets machine time

Double difftime (time_t, time2, time_t, time1) gets two machine time differences, in seconds

Long dostounix (struct, data, *d, time, *t, struct) converts the date and time format of DOS to the UNIX standard

(machine time (used in dos.h libraries)

无效unixtodos(长将日期* D,结构,结构时间* T)

将UNIX格式的时间和日期转换成DOS格式(由时间和日期两部分组成,只能由机器时间得到,并且用到DOS。H库)

void getDate(struct日期* D)得到系统日期,D存放得到的日期信息

无效设置日期(struct日期* D)

无效时间(struct日期* T)得到系统时间D存放得到的时间信息

无效时间(struct日期* T)

C语言的标准库函数包括一系列日期和时间处理函数,它们都在头文件中说明。下面列出了这些函数。

在头文件中定义了三种类型:time_t,struct tm和clock_t。

在中说明的C语言时间函数

time_t时间(time_t *定时器);

双difftime(time_t time_t 1,2);

结构TM gmtime(const time_

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值