迷茫2017-04-17 13:00:58
你在說mktime麼?
#include <stdio.h>
#include <time.h>
int main(void)
{
struct tm tm = *localtime(&(time_t){time(NULL)});
printf("Today is %s", asctime(&tm));
tm.tm_mon -= 100;
mktime(&tm);
printf("100 months ago was %s", asctime(&tm));
}
輸出:
Today is Sun Oct 4 19:11:45 2015
100 months ago was Mon Jun 4 19:11:45 2007