您的位置首页生活快答

c 语言 函数的参数 (win tc)

c 语言 函数的参数 (win tc)

的有关信息介绍如下:

c 语言 函数的参数 (win tc)

localtime 函数名: localtime

功 能: 把从1970-1-1零点零分到当前时间系统所偏移的秒数时间转换为日历时间

用 法: struct tm *localtime(const time_t *clock);

程序例:

#include "stdio.h"

#include "stddef.h"

int main(void)

{

time_t timer;

struct tm *tblock;

/* gets time of day */

timer = time(NULL);

/* converts date/time to a structure */

tblock = localtime(&timer);

printf("Local time is: %s", asctime(tblock));

return 0;

}