37 return 86400000000000ll;
44 return 3600000000000ll;
191 numericCast<Ticks>(days) *
192 TimeTraits::nanosecondsPerDay() +
193 numericCast<Ticks>(hours) *
194 TimeTraits::nanosecondsPerHour() +
195 numericCast<Ticks>(minutes) *
196 TimeTraits::nanosecondsPerMinute() +
197 numericCast<Ticks>(seconds) *
198 TimeTraits::nanosecondsPerSecond() +
212 numericCast<Ticks>(hours) *
213 TimeTraits::nanosecondsPerHour() +
214 numericCast<Ticks>(minutes) *
215 TimeTraits::nanosecondsPerMinute() +
216 numericCast<Ticks>(seconds) *
217 TimeTraits::nanosecondsPerSecond() +
228 TimeTraits::nanosecondsPerDay());
239 TimeTraits::nanosecondsPerHour()) %
240 TimeTraits::hoursPerDay()
250 numericCast<Minutes>(
252 TimeTraits::nanosecondsPerMinute()) %
253 TimeTraits::minutesPerHour()
263 numericCast<Seconds>(
265 TimeTraits::nanosecondsPerSecond()) %
266 TimeTraits::secondsPerMinute()
276 numericCast<Milliseconds>
278 TimeTraits::nanosecondsPerMillisecond()) %
279 TimeTraits::millisecondsPerSecond()
289 numericCast<Microseconds>
291 TimeTraits::nanosecondsPerMicrosecond()) %
292 TimeTraits::microsecondsPerSecond()
302 numericCast<Nanoseconds>
304 TimeTraits::nanosecondsPerSecond());
319 ticks_ += other.ticks_;
327 ticks_ -= other.ticks_;
335 std::swap(ticks_, other.ticks_);
351 return left.ticks() == right.ticks();
358 return left.ticks() != right.ticks();
365 return left.ticks() < right.ticks();
372 return left.ticks() > right.ticks();
416 toStr(str, timeSpan, format);
522 Nanosecond nanosecond = 0)
526 hour, minute, second, nanosecond)
532 : sinceEpoch_(other.sinceEpoch_)
539 Year year;
Month month; Day day;
541 toDate(sinceEpoch_, year, month, day);
549 Year year;
Month month; Day day;
551 toDate(sinceEpoch_, year, month, day);
559 Year year;
Month month; Day day;
561 toDate(sinceEpoch_, year, month, day);
569 return static_cast<Hour
>(time().hours());
575 return static_cast<Minute
>(time().minutes());
581 return static_cast<Second
>(time().seconds());
587 return static_cast<Millisecond
>(time().milliseconds());
593 return static_cast<Microsecond
>(time().microseconds());
599 return static_cast<Nanosecond
>(time().nanoseconds());
609 TimeTraits::nanosecondsPerDay());
618 TimeTraits::nanosecondsPerDay());
629 sinceEpoch_ = other.sinceEpoch_;
637 std::swap(sinceEpoch_, other.sinceEpoch_);
651 static Ticks toTicks(Year,
Month, Day, Hour, Minute, Second, Nanosecond);
655 static void toDate(Ticks, Year&,
Month&, Day&);
731 timestamp.sinceEpoch() +
742 timestamp.sinceEpoch() -
751 return TimeSpan(left.sinceEpoch() - right.sinceEpoch());
789 toStr(str, timestamp, format);
800 return os <<
toStr(value);
806 return os <<
toStr(value);
820 ts, str.c_str(), str.size());
834 ts, str.c_str(), str.size(), format);
846 throw std::runtime_error(
"Error parsing timestamp.");
860 throw std::runtime_error(
"Error parsing timespan.");
868 return toStr(*
this, format);
874 return toStr(*
this, format);
Timestamp(Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
Explicit time-stamp initialization.
void swap(TimeSpan &other) noexcept
Swaps.
The time point without the time-zone information.
Ticks ticks() const noexcept
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_END
#define ONIXS_B3_BOE_LTWT_STRUCT
Hours hours() const noexcept
static constexpr Int32 microsecondsPerSecond() noexcept
Int32 Days
Integral type for number of days.
void toStrAsYYYYMMDDHHMMSSpsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSpsec format.
void toStrAsYYYYMMDDHHMMSSnsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSnsec format.
static constexpr Int64 nanosecondsPerMinute() noexcept
UInt32 Minute
Integral type presenting the minute component.
bool operator<=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
Int32 Hours
Integral type for number of hours.
std::ostream & operator<<(std::ostream &os, const TimeSpan &value)
#define ONIXS_B3_BOE_NOTHROW
static constexpr Int32 secondsPerMinute() noexcept
TimeSpan & operator-=(const TimeSpan &other) noexcept
Subtracts the given time interval.
bool operator>=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
#define ONIXS_B3_BOE_EXPORTED
Timestamp operator+(const Timestamp ×tamp, const TimeSpan &timeSpan) noexcept
Adds the time interval.
void toStrAsHHMMSSpsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.ssssssssssss pattern.
Nanosecond nanosecond() const noexcept
#define ONIXS_B3_BOE_CONSTEXPR
bool operator>(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
Days days() const noexcept
Int64 Ticks
Integral type presenting internal ticks.
UInt32 Year
Integral type presenting the year component.
size_t toStr(Timestamp, Char *, size_t)
Serializes the timestamp.
void toStrAsYYYYMMDDHHMMSSusec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSusec format.
Timestamp makeTimestamp(Timestamp::Ticks ticks) noexcept
Make Timestamp helper.
Int32 Seconds
Integral type for number of seconds.
#define ONIXS_B3_BOE_NODISCARD
static constexpr Int64 nanosecondsPerDay() noexcept
Minutes minutes() const noexcept
Int32 Nanoseconds
Integral type for number of nanoseconds.
static constexpr Int32 millisecondsPerSecond() noexcept
void toStrAsHHMMSS(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS pattern.
bool operator<(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
TimeSpan(Ticks ticks=0) noexcept
Initializes the timespan from the given number of ticks.
Ticks sinceEpoch() const noexcept
UInt32 Nanosecond
Integral type presenting the nanosecond component.
void toStrAsHHMMSSnsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.sssssssss pattern.
UInt32 Hour
Integral type presenting the hour component.
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_BEGIN
void toStrAsYYYYMMDDHHMMSSmsec(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSSmsec format.
Seconds seconds() const noexcept
Microseconds microseconds() const noexcept
Milliseconds milliseconds() const noexcept
Int32 Milliseconds
Integral type for number of milliseconds.
#define ONIXS_B3_BOE_LTWT_CLASS
void toStrAsYYYYMMDD(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDD format.
TimeSpan(Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Initializes with the given set of values.
TimeSpan & operator+=(const TimeSpan &other) noexcept
Adds the given time interval.
static constexpr Int32 nanosecondsPerMillisecond() noexcept
Timestamp & operator=(const Timestamp &other) noexcept
Timestamp(const Timestamp &other) noexcept
Second second() const noexcept
Minute minute() const noexcept
Miscellaneous time characteristics.
UInt32 Millisecond
Integral type presenting the millisecond component.
Millisecond millisecond() const noexcept
UInt32 Second
Integral type presenting the second component.
char Char
Character type alias.
OnixS::B3::BOE::Messaging::Month::Enum Month
Type presenting the month component.
Microsecond microsecond() const noexcept
UInt32 Day
Integral type presenting the day component.
void toStrAsSDHHMMSSnsec(std::string &, TimeSpan)
Serializes the timespan according to the D.HH:MM:SS.sssssssss pattern.
static constexpr Int32 minutesPerHour() noexcept
Nanoseconds nanoseconds() const noexcept
TimeSpan(Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Initializes with the given set of values.
UInt32 Microsecond
Integral type presenting the microsecond component.
bool fromStr(Timestamp &ts, const std::string &str, TimestampFormat::Enum format=TimestampFormat::YYYYMMDDHHMMSSnsec)
De-serializes a timestamp from the given string.
void swap(Timestamp &other) noexcept
Exchanges the value.
bool operator==(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
Timestamp(Ticks ticks=0) noexcept
Initializes from the number of ticks since epoch.
#define ONIXS_B3_BOE_LTWT_EXPORTED
Timestamp date() const noexcept
TimeSpan time() const noexcept
UInt64 Ticks
Integral type storing internal ticks.
Int32 Minutes
Integral type for number of minutes.
#define ONIXS_B3_BOE_PURE
Int32 Microseconds
Integral type for number of microseconds.
Hour hour() const noexcept
static constexpr Int64 nanosecondsPerHour() noexcept
void toStrAsYYYYMMDDHHMMSS(std::string &, Timestamp)
Serializes the timestamp using the YYYYMMDDHHMMSS format.
static constexpr Int32 nanosecondsPerMicrosecond() noexcept
static constexpr Int32 nanosecondsPerSecond() noexcept
bool operator!=(const Timestamp &left, const Timestamp &right) noexcept
Compares instances.
void toStrAsHHMMSSmsec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.sss pattern.
static constexpr Int32 hoursPerDay() noexcept
void toStrAsHHMMSSusec(std::string &, TimeSpan)
Serializes the timespan according to the HH:MM:SS.ssssss pattern.
TimeSpan operator-(const Timestamp &left, const Timestamp &right) noexcept
Calculates the time interval between two time points.