37 lines
No EOL
1.3 KiB
C++
37 lines
No EOL
1.3 KiB
C++
#pragma once
|
|
#include "dtcore/inc/dtstream.h"
|
|
#include "dtcore/inc/dtdatetime.h"
|
|
|
|
namespace dt
|
|
{
|
|
// This class works with UTC time
|
|
class Time : public Serializable
|
|
{
|
|
public:
|
|
DT_CORE_DLL_ENTRY Time() = default;
|
|
DT_CORE_DLL_ENTRY Time(const DateTime& dateTime);
|
|
DT_CORE_DLL_ENTRY Time(int hour, int min, int sec); // Provide UTC time
|
|
|
|
DT_CORE_DLL_ENTRY int GetHour() const { return m_Hour; }
|
|
DT_CORE_DLL_ENTRY int GetMin() const { return m_Min; }
|
|
DT_CORE_DLL_ENTRY int GetSec() const { return m_Sec; }
|
|
|
|
DT_CORE_DLL_ENTRY bool IsValid() const;
|
|
|
|
DT_CORE_DLL_ENTRY bool operator>(const Time& moment) const;
|
|
DT_CORE_DLL_ENTRY bool operator>=(const Time& moment) const;
|
|
DT_CORE_DLL_ENTRY bool operator<(const Time& moment) const;
|
|
DT_CORE_DLL_ENTRY bool operator<=(const Time& moment) const;
|
|
DT_CORE_DLL_ENTRY bool operator==(const Time& moment) const;
|
|
DT_CORE_DLL_ENTRY bool operator!=(const Time& moment) const;
|
|
|
|
DT_CORE_DLL_ENTRY virtual void Serialize(U8 version, Stream& stream) override;
|
|
|
|
private:
|
|
S32 m_Hour = INVALID_VALUE;
|
|
S32 m_Min = INVALID_VALUE;
|
|
S32 m_Sec = INVALID_VALUE;
|
|
};
|
|
|
|
DT_CORE_DLL_ENTRY String& operator<<(String& out, const Time& time);
|
|
} |