2017-09-28 01:04:27 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <qglobal.h>
|
2017-10-09 06:20:27 -05:00
|
|
|
#include <qnamespace.h>
|
2017-09-28 01:04:27 -05:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2017-10-03 07:03:23 -05:00
|
|
|
class QDateTime;
|
2017-10-09 06:03:42 -05:00
|
|
|
class QDate;
|
|
|
|
class QTime;
|
|
|
|
|
2017-09-28 01:04:27 -05:00
|
|
|
//==================================================================================================
|
|
|
|
//
|
|
|
|
//==================================================================================================
|
2017-10-03 07:03:23 -05:00
|
|
|
class RiaQDateTimeTools
|
2017-09-28 01:04:27 -05:00
|
|
|
{
|
|
|
|
public:
|
2017-10-09 06:03:42 -05:00
|
|
|
static Qt::TimeSpec currentTimeSpec();
|
|
|
|
|
2017-10-03 07:03:23 -05:00
|
|
|
static QDateTime fromString(const QString& dateString, const QString& format);
|
|
|
|
static QDateTime fromYears(double years);
|
|
|
|
|
|
|
|
static QDateTime addDays(const QDateTime& dt, double days);
|
|
|
|
static QDateTime addYears(const QDateTime& dt, double years);
|
2017-09-28 01:04:27 -05:00
|
|
|
|
2017-10-03 07:03:23 -05:00
|
|
|
static QDateTime epoch();
|
2017-09-28 01:04:27 -05:00
|
|
|
|
2017-10-09 06:03:42 -05:00
|
|
|
static QDateTime createDateTime();
|
|
|
|
static QDateTime createDateTime(const QDate& date);
|
|
|
|
static QDateTime createDateTime(const QDate& date, const QTime& time);
|
|
|
|
|
2017-09-28 01:04:27 -05:00
|
|
|
private:
|
2017-10-03 07:03:23 -05:00
|
|
|
static quint64 secondsInDay();
|
|
|
|
static quint64 secondsInYear();
|
2017-09-28 01:04:27 -05:00
|
|
|
};
|