标签:使用 include class ber 获取 number cond ftime 特性
以下是使用C11特性获取当前日期时间的方法
#include <stdio.h> #include <time.h> int main(int argc, char * argv[]) { time_t seconds_number = time(NULL); tm local_time; localtime_s(&local_time, &seconds_number); char date[11]; if (strftime(date, sizeof(date), "%F", &local_time)) { printf("%s\n", date); } char date_time[20]; if (strftime(date_time, sizeof(date_time), "%F %T", &local_time)) { printf("%s\n", date_time); } return 0; }
标签:使用 include class ber 获取 number cond ftime 特性
原文地址:http://www.cnblogs.com/xfjiangnanke/p/6815266.html