Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
#if !defined(__CTIME__)
|
|
#define __CTIME__
|
|
|
|
#if !defined(TIMEDATE_YEAR_BASE)
|
|
#define TIMEDATE_YEAR_BASE 1900
|
|
#endif // !defined(TIMEDATE_YEAR_BASE)
|
|
|
|
#if !defined(TIMEDATE_YEAR_BITS)
|
|
#define TIMEDATE_YEAR_BITS 8
|
|
#endif // !defined(TIMEDATE_YEAR_BITS)
|
|
|
|
#define TIMEDATE_RESERVED_BITS (32 - (5 + 4 + TIMEDATE_YEAR_BITS + 1 + 1)) // 13?
|
|
|
|
class CTimeDate
|
|
{
|
|
public:
|
|
union {
|
|
struct {
|
|
// Bit Field는 앞쪽에 지정된 것이 LowBit이다.
|
|
DWORD m_xDay: 5; // 2^0, 2^5-1
|
|
DWORD m_xMonth: 4; // 2^5, 2^4-1
|
|
DWORD m_xYear: TIMEDATE_YEAR_BITS; // from 1900-2155 // 2^9, 2^8-1
|
|
DWORD m_xReserved: TIMEDATE_RESERVED_BITS; // 2^17,2^13-1
|
|
DWORD m_xLunar: 1; // lunar system not solar system // 2^30, 2^1-1
|
|
DWORD m_xLeap: 1; // leap month? in case of lunar system // 2^31, 2^1-1
|
|
} m_LN;
|
|
long m_lDate;
|
|
};
|
|
public:
|
|
CTimeDate() { m_lDate = 0; } // TIMEDATE_YEAR_BASE/1/1 in solar
|
|
CTimeDate(const CTimeDate& that) { m_lDate = that.m_lDate; }
|
|
operator long& () { return *(long*)&m_lDate; }
|
|
static BOOL IsLeapYear(int nYear);
|
|
static long GetCurrent();
|
|
int const GetYear() const { return m_LN.m_xYear + TIMEDATE_YEAR_BASE; }
|
|
int const GetMonth() const { return m_LN.m_xMonth; }
|
|
int const GetDay() const { return m_LN.m_xDay; }
|
|
void CurrentDate();
|
|
BOOL GetDate(long lDate, BOOL bLunar = FALSE, BOOL bLeap = FALSE);
|
|
};
|
|
|
|
class CTimeLong
|
|
{
|
|
public:
|
|
long m_lTime; // time_t
|
|
public:
|
|
CTimeLong() { m_lTime = 0; }
|
|
CTimeLong(const CTimeLong& that) { m_lTime = that.m_lTime; }
|
|
operator long& () { return *(long*)&m_lTime; }
|
|
static long GetCurrent();
|
|
void CurrentTime();
|
|
void GetTime(tm& t) const;
|
|
};
|
|
|
|
#endif //!defined(__CTIME__)
|