#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <utime.h> #include <time.h> int main(){ int ret;struct utimbuf times = {0}; time_t cur_sec; time(&cur_sec); printf("%ti\n",cur_sec); times.actime = cur_sec-86400 ; printf("%ti\n",times.actime); times.modtime = cur_sec-86400; ret = utime("./test.txt", ×); exit(0); }
标签:cur,times,修改,日期,很早,sec,include From: https://www.cnblogs.com/miwaiwai/p/17653879.html