Add {TimeSpan,DateTime}::ticks() for easier read/write

consistent_macro_prefix
Martchus 5 years ago
parent e0fee70d58
commit 7b01938ece
  1. 9
      chrono/datetime.h
  2. 9
      chrono/timespan.h

@ -64,6 +64,7 @@ public:
static DateTime fromTimeStamp(time_t timeStamp);
static DateTime fromTimeStampGmt(time_t timeStamp);
uint64 &ticks();
constexpr uint64 totalTicks() const;
int year() const;
int month() const;
@ -212,6 +213,14 @@ inline DateTime DateTime::fromIsoStringLocal(const char *str)
return fromIsoString(str).first;
}
/*!
* \brief Returns a mutable reference to the total ticks.
*/
inline uint64 &DateTime::ticks()
{
return m_ticks;
}
/*!
* \brief Returns the number of ticks which represent the value of the current instance.
*/

@ -42,6 +42,7 @@ public:
static constexpr TimeSpan negativeInfinity();
static constexpr TimeSpan infinity();
int64 &ticks();
constexpr int64 totalTicks() const;
constexpr double totalMicroseconds() const;
constexpr double totalMilliseconds() const;
@ -181,6 +182,14 @@ constexpr inline TimeSpan TimeSpan::infinity()
return TimeSpan(std::numeric_limits<decltype(m_ticks)>::max());
}
/*!
* \brief Returns a mutable reference to the total ticks.
*/
inline int64 &TimeSpan::ticks()
{
return m_ticks;
}
/*!
* \brief Returns the number of ticks that represent the value of the current TimeSpan class.
*/

Loading…
Cancel
Save