mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1984 Ensure QDateTime spec set to UTC
This commit is contained in:
parent
97e60ab5f2
commit
6674f6087a
@ -122,7 +122,7 @@ QDateTime RiaQDateTimeTools::epoch()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QDateTime RiaQDateTimeTools::createDateTime()
|
QDateTime RiaQDateTimeTools::createUtcDateTime()
|
||||||
{
|
{
|
||||||
auto qdt = QDateTime();
|
auto qdt = QDateTime();
|
||||||
qdt.setTimeSpec(currentTimeSpec());
|
qdt.setTimeSpec(currentTimeSpec());
|
||||||
@ -132,7 +132,7 @@ QDateTime RiaQDateTimeTools::createDateTime()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QDateTime RiaQDateTimeTools::createDateTime(const QDate& date)
|
QDateTime RiaQDateTimeTools::createUtcDateTime(const QDate& date)
|
||||||
{
|
{
|
||||||
auto qdt = QDateTime(date);
|
auto qdt = QDateTime(date);
|
||||||
qdt.setTimeSpec(currentTimeSpec());
|
qdt.setTimeSpec(currentTimeSpec());
|
||||||
@ -142,7 +142,7 @@ QDateTime RiaQDateTimeTools::createDateTime(const QDate& date)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QDateTime RiaQDateTimeTools::createDateTime(const QDate& date, const QTime& time)
|
QDateTime RiaQDateTimeTools::createUtcDateTime(const QDate& date, const QTime& time)
|
||||||
{
|
{
|
||||||
auto qdt = QDateTime(date, time, currentTimeSpec());
|
auto qdt = QDateTime(date, time, currentTimeSpec());
|
||||||
return qdt;
|
return qdt;
|
||||||
|
@ -43,9 +43,9 @@ public:
|
|||||||
|
|
||||||
static QDateTime epoch();
|
static QDateTime epoch();
|
||||||
|
|
||||||
static QDateTime createDateTime();
|
static QDateTime createUtcDateTime();
|
||||||
static QDateTime createDateTime(const QDate& date);
|
static QDateTime createUtcDateTime(const QDate& date);
|
||||||
static QDateTime createDateTime(const QDate& date, const QTime& time);
|
static QDateTime createUtcDateTime(const QDate& date, const QTime& time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static quint64 secondsInDay();
|
static quint64 secondsInDay();
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
class RimSummaryCurve;
|
class RimSummaryCurve;
|
||||||
class RimAsciiDataCurve;
|
class RimAsciiDataCurve;
|
||||||
class RicPasteAsciiDataToSummaryPlotFeatureUi;
|
class RicPasteAsciiDataToSummaryPlotFeatureUi;
|
||||||
|
@ -22,11 +22,8 @@
|
|||||||
#include "RifSummaryReaderInterface.h"
|
#include "RifSummaryReaderInterface.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class QDateTime;
|
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
class RifColumnBasedUserDataParser;
|
class RifColumnBasedUserDataParser;
|
||||||
@ -53,7 +50,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<RifColumnBasedUserDataParser> m_parser;
|
std::unique_ptr<RifColumnBasedUserDataParser> m_parser;
|
||||||
std::vector< std::vector<time_t> > m_timeSteps;
|
std::vector< std::vector<time_t> > m_timeSteps;
|
||||||
|
|
||||||
std::map<RifEclipseSummaryAddress, size_t > m_mapFromAddressToTimeStepIndex;
|
std::map<RifEclipseSummaryAddress, size_t > m_mapFromAddressToTimeStepIndex;
|
||||||
std::map<RifEclipseSummaryAddress, std::pair<size_t, size_t> > m_mapFromAddressToResultIndex;
|
std::map<RifEclipseSummaryAddress, std::pair<size_t, size_t> > m_mapFromAddressToResultIndex;
|
||||||
|
@ -20,12 +20,8 @@
|
|||||||
|
|
||||||
#include "RifEclipseSummaryAddress.h"
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QLocale>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct ColumnInfo;
|
struct ColumnInfo;
|
||||||
|
@ -160,7 +160,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
|
|||||||
int year = 0;
|
int year = 0;
|
||||||
getDayMonthYear(kwINTEHEAD, &day, &month, &year);
|
getDayMonthYear(kwINTEHEAD, &day, &month, &year);
|
||||||
|
|
||||||
QDateTime reportDateTime = RiaQDateTimeTools::createDateTime(QDate(year, month, day));
|
QDateTime reportDateTime = RiaQDateTimeTools::createUtcDateTime(QDate(year, month, day));
|
||||||
CVF_ASSERT(reportDateTime.isValid());
|
CVF_ASSERT(reportDateTime.isValid());
|
||||||
|
|
||||||
double dayValue = dayValues[i];
|
double dayValue = dayValues[i];
|
||||||
|
@ -258,9 +258,7 @@ QDateTime RifHdf5Reader::sourSimDateTimeToQDateTime(std::string dateString) cons
|
|||||||
QDate d(year, month, day);
|
QDate d(year, month, day);
|
||||||
QTime t(hours, minutes, seconds);
|
QTime t(hours, minutes, seconds);
|
||||||
|
|
||||||
QDateTime dt;
|
QDateTime dt = RiaQDateTimeTools::createUtcDateTime(d, t);
|
||||||
dt.setDate(d);
|
|
||||||
dt.setTime(t);
|
|
||||||
|
|
||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class QDateTime;
|
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
class RifColumnBasedAsciiParser;
|
class RifColumnBasedAsciiParser;
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
virtual std::string unitName(const RifEclipseSummaryAddress& resultAddress) const = 0;
|
virtual std::string unitName(const RifEclipseSummaryAddress& resultAddress) const = 0;
|
||||||
|
|
||||||
// TODO: Move this to a tools class with static members
|
// TODO: Move this to a tools class with static members
|
||||||
static std::vector<QDateTime> fromTimeT(const std::vector<time_t>& timeSteps);
|
static std::vector<QDateTime> fromTimeT(const std::vector<time_t>& timeSteps);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<RifEclipseSummaryAddress> m_allResultAddresses;
|
std::vector<RifEclipseSummaryAddress> m_allResultAddresses;
|
||||||
|
Loading…
Reference in New Issue
Block a user