25 return ((
_year % 100) & 0x1F) << 24
36 _year = (packedTime >> 24) & 0x1F;
40 _month = (packedTime >> 20) & 0xF;
52 _hour = (packedTime >> 6) & 0x1F;
60 _flags = (packedTime >> 29) & 0x3;
71 buf.tm_year =
_year + 100;
89 if (!::gmtime_r(&unixTime, &buf))
92 _year = (buf.tm_year - 100) % 100;
102 ASSERT(year == -1 || (year >= 0 && year < 32));
108 ASSERT(month == -1 || (month >= 0 && month < 12));
114 ASSERT(monthDay == -1 || (monthDay >= 0 && monthDay < 32));
120 ASSERT(weekDay == -1 || (weekDay >= 0 && weekDay < 7));
126 ASSERT(hour == -1 || (hour >= 0 && hour < 24));
132 ASSERT(minute == -1 || (minute >= 0 && minute < 60));
144 auto compareFieldIfSet = [&]<
typename T>(T
WowTime::*field) -> std::strong_ordering
146 if (left.*field < 0 || right.*field < 0)
147 return std::strong_ordering::equal;
149 return left.*field <=> right.*field;
170 return std::strong_ordering::equal;
176 return *
this >= from || *
this < to;
178 return *
this >= from && *
this < to;
184 unixTime += seconds.count();
191 return WowTime(*
this) += seconds;
197 unixTime -= seconds.count();
204 return WowTime(*
this) -= seconds;
std::chrono::seconds Seconds
Seconds shorthand typedef.
ByteBuffer & operator>>(ByteBuffer &data, WowTime &wowTime)
ByteBuffer & operator<<(ByteBuffer &data, WowTime const &wowTime)
std::strong_ordering operator<=>(WowTime const &left, WowTime const &right)
void SetPackedTime(uint32 packedTime)
std::time_t GetUnixTimeFromUtcTime() const
void SetWeekDay(int8 weekDay)
WowTime & operator+=(Seconds seconds)
void SetMonth(int8 month)
WowTime operator-(Seconds seconds) const
void SetMonthDay(int8 monthDay)
WowTime & operator-=(Seconds seconds)
uint32 GetPackedTime() const
void SetFlags(int8 flags)
void SetMinute(int8 minute)
WowTime operator+(Seconds seconds) const
void SetUtcTimeFromUnixTime(std::time_t unixTime)
bool IsInRange(WowTime const &from, WowTime const &to) const
constexpr bool is_neq(std::partial_ordering cmp) noexcept