ch13-times.c

来自「linux编程精髓 源代码」· C语言 代码 · 共 24 行

C
24
字号
/* ch13-times.c --- demonstrate locale-based times */#include <stdio.h>#include <locale.h>#include <time.h>int main(void){	char buf[100];	time_t now;	struct tm *curtime;	setlocale(LC_ALL, "");	time(& now);	curtime = localtime(& now);	(void) strftime(buf, sizeof buf,			"It is now %A, %B %d, %Y, %I:%M %p", curtime);	printf("%s\n", buf);	printf("ctime() says: %s", ctime(& now));	exit(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?