Commit f09b6915 authored by rswindell's avatar rswindell
Browse files

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

parent a3cc59b8
/* dirwrap.c */
/* Directory-related system-call wrappers */
// vi: tabstop=4
/* $Id$ */
......@@ -389,6 +388,22 @@ void DLLCALL rewinddir(DIR* dir)
}
#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 */
/****************************************************************************/
......
/* dirwrap.h */
/* Directory system-call wrappers */
// vi: tabstop=4
/* $Id$ */
......@@ -220,6 +219,7 @@ DLLEXPORT BOOL DLLCALL fexist(const char *filespec);
DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */
DLLEXPORT off_t DLLCALL flength(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 BOOL DLLCALL isdir(const char *filename);
DLLEXPORT BOOL DLLCALL isabspath(const char *filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment