Skip to content
Snippets Groups Projects
Commit f09b6915 authored by rswindell's avatar rswindell
Browse files

Created fcdate() to return file creation (rather than mod) time_t.

parent a3cc59b8
No related branches found
No related tags found
No related merge requests found
/* dirwrap.c */
/* Directory-related system-call wrappers */ /* Directory-related system-call wrappers */
// vi: tabstop=4
/* $Id$ */ /* $Id$ */
...@@ -389,6 +388,22 @@ void DLLCALL rewinddir(DIR* dir) ...@@ -389,6 +388,22 @@ void DLLCALL rewinddir(DIR* dir)
} }
#endif /* defined(_MSC_VER) */ #endif /* defined(_MSC_VER) */
/****************************************************************************/
/* Returns the creation time of the file 'filename' in time_t format */
/****************************************************************************/
time_t DLLCALL fcdate(const char* filename)
{
struct stat st;
if(access(filename, 0) < 0)
return -1;
if(stat(filename, &st) != 0)
return -1;
return st.st_ctime;
}
/****************************************************************************/ /****************************************************************************/
/* Returns the time/date of the file in 'filename' in time_t (unix) format */ /* Returns the time/date of the file in 'filename' in time_t (unix) format */
/****************************************************************************/ /****************************************************************************/
......
/* dirwrap.h */
/* Directory system-call wrappers */ /* Directory system-call wrappers */
// vi: tabstop=4
/* $Id$ */ /* $Id$ */
...@@ -220,6 +219,7 @@ DLLEXPORT BOOL DLLCALL fexist(const char *filespec); ...@@ -220,6 +219,7 @@ DLLEXPORT BOOL DLLCALL fexist(const char *filespec);
DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */ DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */
DLLEXPORT off_t DLLCALL flength(const char *filename); DLLEXPORT off_t DLLCALL flength(const char *filename);
DLLEXPORT time_t DLLCALL fdate(const char *filename); DLLEXPORT time_t DLLCALL fdate(const char *filename);
DLLEXPORT time_t DLLCALL fcdate(const char* filename);
DLLEXPORT int DLLCALL setfdate(const char* filename, time_t t); DLLEXPORT int DLLCALL setfdate(const char* filename, time_t t);
DLLEXPORT BOOL DLLCALL isdir(const char *filename); DLLEXPORT BOOL DLLCALL isdir(const char *filename);
DLLEXPORT BOOL DLLCALL isabspath(const char *filename); DLLEXPORT BOOL DLLCALL isabspath(const char *filename);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment