48 result.m_timeInS = timeInH*Seconds_per_Hour;
61 result.m_timeInS = timeInMS/1000.0;
71 static constexpr auto fromS(
double timeInS)
74 result.m_timeInS = timeInS;
82 [[nodiscard]] Q_INVOKABLE
bool isFinite()
const
84 return std::isfinite(m_timeInS);
93 return m_timeInS < 0.0;
104 m_timeInS += other.m_timeInS;
120 [[nodiscard]] Q_INVOKABLE
double toS()
const
129 [[nodiscard]] Q_INVOKABLE
double toM()
const
131 return m_timeInS / Seconds_per_Minute;
138 [[nodiscard]] Q_INVOKABLE
double toH()
const
140 return m_timeInS / Seconds_per_Hour;
150 static constexpr double Seconds_per_Minute = 60.0;
151 static constexpr double Seconds_per_Hour = 60.0 * 60.0;
154 double m_timeInS {NAN};
Convenience class for time computations.
static constexpr auto fromH(double timeInH) -> Timespan
Constructs a time.
Q_INVOKABLE QString toHoursAndMinutes() const
Convert time to string.
static constexpr auto fromS(double timeInS)
Constructs a time.
static constexpr Timespan fromMS(double timeInMS)
Constructs a time.
Q_INVOKABLE Units::Timespan & operator+=(Units::Timespan other)
Add time to this time.
Q_INVOKABLE bool isNegative() const
Checks if the time is negative.
Q_INVOKABLE double toM() const
Convert time to minutes.
Q_INVOKABLE double toS() const
Convert time to seconds.
Q_INVOKABLE std::partial_ordering operator<=>(const Units::Timespan &rhs) const =default
Comparison.
Q_INVOKABLE bool isFinite() const
Checks if the time is valid.
Q_INVOKABLE double toH() const
Convert time to hours.
Conversion between units used in aviation.