日期:2014-05-16 浏览次数:20717 次
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <sys/time.h> int main(int argc, char *argv[]) { time_t mytime = time(0); struct tm* tm_ptr = localtime(&mytime); if (tm_ptr) { tm_ptr->tm_mon = 5; tm_ptr->tm_mday = 1; const struct timeval tv = {mktime(tm_ptr), 0}; settimeofday(&tv, 0); } return 0; }