21 lines
393 B
C
21 lines
393 B
C
#define _USE_GNU
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
|
|
#ifndef WIN32
|
|
# include <unistd.h>
|
|
#else
|
|
# define stat _stat
|
|
#endif
|
|
|
|
// ssize_t abspath(const char *restrict path, char *restrict buf)
|
|
|
|
int get_mod_time(const char *restrict path, struct timespec *restrict mtime) {
|
|
struct stat result;
|
|
if(stat(path, &result) == -1)
|
|
return ERR;
|
|
*mtime = result.st_mtime;
|
|
|
|
return OK;
|
|
}
|