X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77fe02a8e9cccb6d159cccd37e3a24349370e515..7018409531500bd1850c1ab3f0107007802bbc5a:/src/common/filename.cpp diff --git a/src/common/filename.cpp b/src/common/filename.cpp index cf4867b024..041e24a1f4 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -48,6 +48,19 @@ #include "wx/msw/winundef.h" #endif +// at least some of these are required for file mod time +#ifdef __WXGTK__ +#include +#include +#include +#include +#ifndef __VMS +# include +#endif +# include +#include +#endif + // ============================================================================ // implementation // ============================================================================ @@ -152,6 +165,29 @@ bool wxFileName::DirExists( const wxString &dir ) return ::wxDirExists( dir ); } +wxDateTime wxFileName::GetModificationTime() +{ +#ifdef __WXGTK__ + struct stat buff; + stat( GetFullName().fn_str(), &buff ); + +#if !defined( __EMX__ ) && !defined(__VMS) + struct stat lbuff; + lstat( GetFullName().fn_str(), &lbuff ); + struct tm *t = localtime( &lbuff.st_mtime ); +#else + struct tm *t = localtime( &buff.st_mtime ); +#endif + + wxDateTime ret( t->tm_mday, (wxDateTime::Month)t->tm_mon, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec ); +#else + + wxDateTime ret = wxDateTime::Now(); + +#endif + return ret; +} + // ---------------------------------------------------------------------------- // CWD and HOME stuff // ----------------------------------------------------------------------------