二十五岁时我们都一样愚蠢、多愁善感,喜欢故弄玄虚,可如果不那样的话,五十岁时也就不会如此明智。
标题:C库函数 mktime()
C库函数 mktime()
#include <stdio.h> #include <time.h> int main () { int ret; struct tm info; char buffer[80]; info.tm_year = 2001 - 1900; info.tm_mon = 7 - 1; info.tm_mday = 4; info.tm_hour = 0; info.tm_min = 0; info.tm_sec = 1; info.tm_isdst = -1; ret = mktime(&info); if( ret == -1 ) { printf("Error: unable to make time using mktime\n"); } else { strftime(buffer, sizeof(buffer), "%c", &info ); printf(buffer); } return(0); }