diff options
Diffstat (limited to 'src/conditionfiletime.cpp')
-rw-r--r-- | src/conditionfiletime.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/conditionfiletime.cpp b/src/conditionfiletime.cpp index 148ffac..abcb3f3 100644 --- a/src/conditionfiletime.cpp +++ b/src/conditionfiletime.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include "statcache.h" | ||
7 | 8 | ||
8 | #include <bu/sio.h> | 9 | #include <bu/sio.h> |
9 | using namespace Bu; | 10 | using namespace Bu; |
@@ -18,6 +19,7 @@ ConditionFileTime::~ConditionFileTime() | |||
18 | 19 | ||
19 | bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) | 20 | bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) |
20 | { | 21 | { |
22 | StatCache &Stat = StatCache::getInstance(); | ||
21 | for( StrList::const_iterator j = rTarget.getOutputList().begin(); j; j++ ) | 23 | for( StrList::const_iterator j = rTarget.getOutputList().begin(); j; j++ ) |
22 | { | 24 | { |
23 | if( access( (*j).getStr(), F_OK ) ) | 25 | if( access( (*j).getStr(), F_OK ) ) |
@@ -30,22 +32,20 @@ bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) | |||
30 | } | 32 | } |
31 | } | 33 | } |
32 | 34 | ||
33 | time_t tOut = 0; | 35 | time_t tOut = 0, tmp; |
34 | struct stat s; | ||
35 | for( StrList::const_iterator j = rTarget.getOutputList().begin(); | 36 | for( StrList::const_iterator j = rTarget.getOutputList().begin(); |
36 | j; j++ ) | 37 | j; j++ ) |
37 | { | 38 | { |
38 | stat( (*j).getStr(), &s ); | 39 | tmp = Stat.mtime( *j ); |
39 | if( tOut == 0 || tOut > s.st_mtime ) | 40 | if( tOut == 0 || tOut > tmp ) |
40 | { | 41 | { |
41 | tOut = s.st_mtime; | 42 | tOut = tmp; |
42 | } | 43 | } |
43 | } | 44 | } |
44 | for( StrList::const_iterator j = rTarget.getInputList().begin(); | 45 | for( StrList::const_iterator j = rTarget.getInputList().begin(); |
45 | j; j++ ) | 46 | j; j++ ) |
46 | { | 47 | { |
47 | stat( (*j).getStr(), &s ); | 48 | if( tOut < Stat.mtime( *j ) ) |
48 | if( tOut < s.st_mtime ) | ||
49 | { | 49 | { |
50 | //sio << "-- Target processed because '" << *j | 50 | //sio << "-- Target processed because '" << *j |
51 | // << "' is newer than output." << sio.nl; | 51 | // << "' is newer than output." << sio.nl; |
@@ -57,8 +57,7 @@ bool ConditionFileTime::shouldExec( class Runner &r, Target &rTarget ) | |||
57 | for( StrList::const_iterator j = rTarget.getRequiresList().begin(); | 57 | for( StrList::const_iterator j = rTarget.getRequiresList().begin(); |
58 | j; j++ ) | 58 | j; j++ ) |
59 | { | 59 | { |
60 | stat( (*j).getStr(), &s ); | 60 | if( tOut < Stat.mtime( *j ) ) |
61 | if( tOut < s.st_mtime ) | ||
62 | { | 61 | { |
63 | //sio << "-- Target processed because '" << *j | 62 | //sio << "-- Target processed because '" << *j |
64 | // << "' is newer than output." << sio.nl; | 63 | // << "' is newer than output." << sio.nl; |