From 004049afd50ef60860ea0d0da6f5742d66f0ac30 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 23 Nov 2018 15:45:58 +0200 Subject: More backwards modification time experimentation --- build2/depdb.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'build2') diff --git a/build2/depdb.cxx b/build2/depdb.cxx index aec2562..6f906c2 100644 --- a/build2/depdb.cxx +++ b/build2/depdb.cxx @@ -286,6 +286,7 @@ namespace build2 start_ = system_clock::now (); #endif + /* #ifdef _WIN32 // // On Windows there are two times, the precise time (which is what we @@ -300,6 +301,7 @@ namespace build2 wtime_ = mt; // Save for check below. #endif #endif + */ fs_.put ('\0'); // The "end marker". } @@ -310,6 +312,19 @@ namespace build2 if (state_ == state::write) { #ifdef _WIN32 + // + // On Windows there are two times, the precise time (which is what we + // get with system_clock::now()) and what we will call "filesystem time" + // which can lag the precise time by as much as couple of milliseconds. + // + FILETIME ft; + GetSystemTimeAsFileTime (&ft); + mt = to_timestamp (ft); + +#ifdef BUILD2_MTIME_CHECK + wtime_ = mt; // Save for check below. +#endif + auto file_mtime_h = [&to_timestamp] (const path_type& p) -> timestamp { HANDLE h (CreateFile (p.string ().c_str (), -- cgit v1.1