From 9f6ff19074835ce30526da70543a4841c5841768 Mon Sep 17 00:00:00 2001 From: Charles Baker Date: Mon, 1 Jun 2026 16:14:44 +1200 Subject: [PATCH] Initialize earliest timestamps with file_time_type::min() On some system the earliest file time type is a negative value so initializing to 0 is incorrect. This causes the build to repeat over and over again because the default of 0 is always in the future compared with the latest write time of the files. Fixed by initializing default timestamp, last write time, and earliest write times to file_time_type::min() in Target. --- src/forge/Target.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/forge/Target.cpp b/src/forge/Target.cpp index 18de3453..4e5f282d 100644 --- a/src/forge/Target.cpp +++ b/src/forge/Target.cpp @@ -33,8 +33,8 @@ Target::Target() , branch_() , graph_( nullptr ) , rule_( nullptr ) -, timestamp_() -, last_write_time_() +, timestamp_( file_time_type::min() ) +, last_write_time_( file_time_type::min() ) , hash_( 0 ) , pending_hash_( 0 ) , outdated_( false ) @@ -74,8 +74,8 @@ Target::Target( const std::string& id, Graph* graph ) , branch_() , graph_( graph ) , rule_( nullptr ) -, timestamp_() -, last_write_time_() +, timestamp_( file_time_type::min() ) +, last_write_time_( file_time_type::min() ) , hash_( 0 ) , pending_hash_( 0 ) , outdated_( false ) @@ -312,7 +312,7 @@ void Target::bind_to_file() { if ( !filenames_.empty() ) { - file_time_type latest_last_write_time = file_time_type{}; + file_time_type latest_last_write_time = file_time_type::min(); file_time_type earliest_last_write_time = file_time_type::max(); for ( vector::const_iterator filename = filenames_.begin(); filename != filenames_.end(); ++filename ) @@ -327,7 +327,7 @@ void Target::bind_to_file() else { latest_last_write_time = file_time_type::max(); - earliest_last_write_time = file_time_type{}; + earliest_last_write_time = file_time_type::min(); } } @@ -336,8 +336,8 @@ void Target::bind_to_file() } else { - timestamp_ = file_time_type{}; - last_write_time_ = file_time_type{}; + timestamp_ = file_time_type::min(); + last_write_time_ = file_time_type::min(); } bound_to_file_ = true;