mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-03 20:57:39 -06:00
#7403 Replace fromTime_t with fromSecsSinceEpoch
This commit is contained in:
parent
b29952e8a9
commit
f12a3ed1ba
@ -135,7 +135,7 @@ QDateTime RiaQDateTimeTools::fromYears( double years )
|
||||
QDateTime RiaQDateTimeTools::fromTime_t( time_t t )
|
||||
{
|
||||
auto qdt = createUtcDateTime();
|
||||
qdt.setTime_t( t );
|
||||
qdt.setSecsSinceEpoch( t );
|
||||
return qdt;
|
||||
}
|
||||
|
||||
|
@ -498,9 +498,9 @@ void RicSummaryCaseRestartDialog::appendFileInfoToGridLayout( QGridLayout*
|
||||
{
|
||||
CVF_ASSERT( gridLayout );
|
||||
|
||||
QDateTime startDate = QDateTime::fromTime_t( fileInfo.startDate );
|
||||
QDateTime startDate = QDateTime::fromSecsSinceEpoch( fileInfo.startDate );
|
||||
QString startDateString = startDate.toString( RiaQDateTimeTools::dateFormatString() );
|
||||
QDateTime endDate = QDateTime::fromTime_t( fileInfo.endDate );
|
||||
QDateTime endDate = QDateTime::fromSecsSinceEpoch( fileInfo.endDate );
|
||||
QString endDateString = endDate.toString( RiaQDateTimeTools::dateFormatString() );
|
||||
int rowCount = gridLayout->rowCount();
|
||||
|
||||
|
@ -1678,7 +1678,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo
|
||||
|
||||
// Also see RifEclipseOutputFileAccess::timeStepsText for accessing time_t structures
|
||||
time_t stepTime = well_state_get_sim_time( ert_well_state );
|
||||
wellResFrame.m_timestamp = QDateTime::fromTime_t( stepTime );
|
||||
wellResFrame.m_timestamp = QDateTime::fromSecsSinceEpoch( stepTime );
|
||||
}
|
||||
|
||||
// Production type
|
||||
|
@ -1174,8 +1174,8 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
QString description;
|
||||
|
||||
{
|
||||
QDateTime first = QDateTime::fromTime_t( curveTimeStepsX.front() );
|
||||
QDateTime last = QDateTime::fromTime_t( curveTimeStepsX.back() );
|
||||
QDateTime first = QDateTime::fromSecsSinceEpoch( curveTimeStepsX.front() );
|
||||
QDateTime last = QDateTime::fromSecsSinceEpoch( curveTimeStepsX.back() );
|
||||
|
||||
std::vector<QDateTime> timeSteps;
|
||||
timeSteps.push_back( first );
|
||||
@ -1189,8 +1189,8 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
|
||||
{
|
||||
QDateTime first = QDateTime::fromTime_t( curveTimeStepsY.front() );
|
||||
QDateTime last = QDateTime::fromTime_t( curveTimeStepsY.back() );
|
||||
QDateTime first = QDateTime::fromSecsSinceEpoch( curveTimeStepsY.front() );
|
||||
QDateTime last = QDateTime::fromSecsSinceEpoch( curveTimeStepsY.back() );
|
||||
|
||||
std::vector<QDateTime> timeSteps;
|
||||
timeSteps.push_back( first );
|
||||
|
@ -2494,7 +2494,7 @@ void appendToExportDataForCase( QString& out, const std::vector<time_t>& timeSte
|
||||
}
|
||||
}
|
||||
out += "\n";
|
||||
out += QDateTime::fromTime_t( timeSteps[j] ).toUTC().toString( "yyyy-MM-dd hh:mm:ss " );
|
||||
out += QDateTime::fromSecsSinceEpoch( timeSteps[j] ).toUTC().toString( "yyyy-MM-dd hh:mm:ss " );
|
||||
|
||||
for ( size_t k = 0; k < curveData.size(); k++ ) // curves
|
||||
{
|
||||
@ -2549,7 +2549,7 @@ void appendToExportData( QString& out, const std::vector<CurvesData>& curvesData
|
||||
|
||||
for ( auto timeStep : allTimeSteps )
|
||||
{
|
||||
QDateTime timseStepUtc = QDateTime::fromTime_t( timeStep ).toUTC();
|
||||
QDateTime timseStepUtc = QDateTime::fromSecsSinceEpoch( timeStep ).toUTC();
|
||||
QString timeText;
|
||||
|
||||
if ( showTimeAsLongString )
|
||||
|
@ -931,7 +931,7 @@ TEST( RifKeywordBasedRsmspecParserTest, TestTimeSteps )
|
||||
|
||||
QDateTime firstDate = RiaQDateTimeTools::fromYears( 2014.32 );
|
||||
|
||||
EXPECT_TRUE( firstDate == QDateTime::fromTime_t( timeSteps[0] ) );
|
||||
EXPECT_TRUE( firstDate == QDateTime::fromSecsSinceEpoch( timeSteps[0] ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user