diff options
Diffstat (limited to 'build2/target')
-rw-r--r-- | build2/target | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/build2/target b/build2/target index 1b75da3..dd9461c 100644 --- a/build2/target +++ b/build2/target @@ -1098,6 +1098,21 @@ namespace build2 mtime_ = mt; } + // Return true if this target is newer than the specified timestamp. + // + bool + newer (timestamp mt) + { + timestamp mp (mtime ()); + + // What do we do if timestamps are equal? This can happen, for example, + // on filesystems that don't have subsecond resolution. There is not + // much we can do here except detect the case where the target was + // changed on this run. + // + return mt < mp || (mt == mp && state () == target_state::changed); + } + protected: // Return timestamp_unknown if the mtime cannot be loaded. // |