Created
March 25, 2016 20:11
-
-
Save jabedude/7ec5b33bb39d5320964f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <dirent.h> | |
#include <sys/stat.h> | |
#include <time.h> | |
int main(int argc, char* argv[]) | |
{ | |
if (argc < 2) | |
{ | |
printf("Usage: must supply at least one file\n"); | |
return 1; | |
} | |
struct dirent* dir_element; | |
struct stat file_info; | |
time_t c; | |
time_t m; | |
time_t cr; | |
for (int i = 1; i < argc; i++) | |
{ | |
//lstat(dir_element->d_name, &file_info); | |
printf("%s\n", argv[i]); | |
lstat( argv[i], &file_info ); | |
c = (long long)file_info.st_atim.tv_sec; | |
m = (long long)file_info.st_mtim.tv_sec; | |
cr = (long long)file_info.st_ctim.tv_sec; | |
printf("Create time: %s", ctime( &cr ) ); | |
printf("Access time: %s", ctime( &c ) ); | |
printf("Modification time: %s", ctime( &m ) ); | |
//printf("%lld.%.9ld\n", (long long)file_info.st_atim.tv_sec, file_info.st_atim.tv_nsec); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment