|  | 
| 17 | 17 |  | 
| 18 | 18 |  The '-l' option indicates that lstat() rather than stat() should be used. | 
| 19 | 19 | */ | 
|  | 20 | +#define _XOPEN_SOURCE 700 | 
| 20 | 21 | #include <sys/sysmacros.h> | 
| 21 | 22 | #if defined(_AIX) | 
| 22 | 23 | #define _BSD | 
| @@ -79,9 +80,13 @@ displayStatInfo(const struct stat *sb) | 
| 79 | 80 |  printf("Optimal I/O block size: %ld bytes\n", (long) sb->st_blksize); | 
| 80 | 81 |  printf("512B blocks allocated: %lld\n", (long long) sb->st_blocks); | 
| 81 | 82 | 
 | 
| 82 |  | - printf("Last file access: %s", ctime(&sb->st_atime)); | 
| 83 |  | - printf("Last file modification: %s", ctime(&sb->st_mtime)); | 
| 84 |  | - printf("Last status change: %s", ctime(&sb->st_ctime)); | 
|  | 83 | + char atime_str[26], ctime_str[26], mtime_str[26]; | 
|  | 84 | + ctime_r(&sb->st_atime, atime_str); atime_str[19] = '0円'; | 
|  | 85 | + ctime_r(&sb->st_mtime, mtime_str); mtime_str[19] = '0円'; | 
|  | 86 | + ctime_r(&sb->st_ctime, ctime_str); ctime_str[19] = '0円'; | 
|  | 87 | + printf("Last file access: %s.%09ld %s", atime_str, sb->st_atim.tv_nsec, atime_str+20); | 
|  | 88 | + printf("Last file modification: %s.%09ld %s", mtime_str, sb->st_mtim.tv_nsec, mtime_str+20); | 
|  | 89 | + printf("Last status change: %s.%09ld %s", ctime_str, sb->st_ctim.tv_nsec, ctime_str+20); | 
| 85 | 90 | } | 
| 86 | 91 | 
 | 
| 87 | 92 | int | 
|  | 
0 commit comments