- 论坛徽章:
- 0
|
平台:AS3U8
在linux用stat取超过2G文件创建时间不准
程序段******************************************
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
int main()
{
struct stat mystat;
char *time_fmt="%Y-%m-%d %H:%M:%S";
char fdate[20];
char *myfile="./test.gz";
stat(myfile,&mystat);
printf("file size : %u\n",(unsigned long)mystat.st_size);
strftime(fdate,sizeof(fdate),time_fmt,localtime(&(mystat.st_ctime)));
printf("file ctime: %s\n",fdate);
}
结果输出****************************************************
# gcc -o mystat mystat.c
# ./mystat
file size : 2165318883
file ctime: 1935-12-23 08:48:40
# ll test.gz
-rw-r--r-- 1 root root 2165318883 Jan 6 05:59 test.gz
# date
Tue Jan 9 11:19:02 CST 2007
ls源代码中查找中…… |
|