mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
#12927 Add optional time threshold before creating ESMRY
When checking timestamp for ESMRY vs SMSPEC, allow ESMRY to be written before SMSPEC within a given limit in time difference.
This commit is contained in:
1 parent
b321109904
commit
e98bc867e4
6 files changed
+47
-10
No files matched your search
@@ -372,13 +372,18 @@ std::map<QString, QStringList> keyPathComponentsForEachFilePath( const QStringLi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool isFirstOlderThanSecond( const std::string& firstFileName, const std::string& secondFileName )
|
||||
bool isFirstOlderThanSecond( const std::string& firstFileName, const std::string& secondFileName, int timeThresholdInSeconds )
|
||||
{
|
||||
if ( !std::filesystem::exists( firstFileName ) || !std::filesystem::exists( secondFileName ) ) return false;
|
||||
|
||||
auto timeFirstFile = std::filesystem::last_write_time( firstFileName );
|
||||
auto timeSecondFile = std::filesystem::last_write_time( secondFileName );
|
||||
|
||||
if ( timeThresholdInSeconds > 0 )
|
||||
{
|
||||
auto timeDiff = std::chrono::seconds( timeThresholdInSeconds );
|
||||
timeFirstFile += timeDiff;
|
||||
}
|
||||
return ( timeFirstFile < timeSecondFile );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user