diff options
Diffstat (limited to '')
-rw-r--r-- | src/statcache.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/statcache.cpp b/src/statcache.cpp new file mode 100644 index 0000000..3f5c21f --- /dev/null +++ b/src/statcache.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include "statcache.h" | ||
2 | |||
3 | #include <sys/stat.h> | ||
4 | |||
5 | #include <bu/sio.h> | ||
6 | |||
7 | StatCache::StatCache() | ||
8 | { | ||
9 | } | ||
10 | |||
11 | StatCache::~StatCache() | ||
12 | { | ||
13 | } | ||
14 | |||
15 | time_t StatCache::mtime( const Bu::FString &sFileName ) | ||
16 | { | ||
17 | try | ||
18 | { | ||
19 | return hMTime.get( sFileName ); | ||
20 | } catch( ... ) | ||
21 | { | ||
22 | struct stat s; | ||
23 | stat( sFileName.getStr(), &s ); | ||
24 | hMTime.insert( sFileName, s.st_mtime ); | ||
25 | return s.st_mtime; | ||
26 | } | ||
27 | } | ||
28 | |||