From a47ce4a7648a003e2fd42fd636c55f73e120d3a3 Mon Sep 17 00:00:00 2001
From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= <vslavik@fastmail.fm>
Date: Wed, 19 Jan 2000 01:00:25 +0000
Subject: [PATCH] added wxFileModificationTime

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/function.tex |  7 +++++++
 include/wx/filefn.h        |  5 +++++
 src/common/filefn.cpp      | 11 +++++++++++
 3 files changed, 23 insertions(+)

diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index 678a7ce63f..8e94b4ddec 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -86,6 +86,13 @@ slashes.
 Returns TRUE if the file exists. It also returns TRUE if the file is
 a directory.
 
+\membersection{::wxFileModificationTime}
+
+\func{time_t}{wxFileModificationTime}{\param{const wxString\& }{filename}}
+
+Returns time of last modification of given file.
+
+
 \membersection{::wxFileNameFromPath}
 
 \func{wxString}{wxFileNameFromPath}{\param{const wxString\& }{path}}
diff --git a/include/wx/filefn.h b/include/wx/filefn.h
index 8179b6b758..7c87b024a1 100644
--- a/include/wx/filefn.h
+++ b/include/wx/filefn.h
@@ -18,6 +18,8 @@
 
 #include "wx/list.h"
 
+#include <time.h>
+
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
@@ -212,6 +214,9 @@ WXDLLEXPORT bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const w
 // On non-Windows platform, probably just return the empty string.
 WXDLLEXPORT wxString wxGetOSDirectory();
 
+// Get file modification time
+WXDLLEXPORT time_t wxFileModificationTime(const wxString& filename);
+
 // ----------------------------------------------------------------------------
 // classes
 // ----------------------------------------------------------------------------
diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index b2cf5e2950..422cb94d68 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -1811,6 +1811,17 @@ void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,
     }
 }
 
+
+
+time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename)
+{
+    struct stat buf;
+
+    stat(filename.fn_str(), &buf);
+    return buf.st_mtime;
+}
+
+
 //------------------------------------------------------------------------
 // wild character routines
 //------------------------------------------------------------------------
-- 
2.50.0

