diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Utilities/DateTime.h |
Diffstat (limited to 'Runtime/Utilities/DateTime.h')
-rw-r--r-- | Runtime/Utilities/DateTime.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Runtime/Utilities/DateTime.h b/Runtime/Utilities/DateTime.h new file mode 100644 index 0000000..b747628 --- /dev/null +++ b/Runtime/Utilities/DateTime.h @@ -0,0 +1,30 @@ +#pragma once + +#include "Runtime/Serialize/SerializeUtility.h" + +struct DateTime +{ + // We are wasting memory and serialization + // in assetdatabase is wrong because of the alignment! + // We do this change in 1.5 because it will force a rebuild of all assets + UInt16 highSeconds; + UInt16 fraction; + UInt32 lowSeconds; + DECLARE_SERIALIZE_OPTIMIZE_TRANSFER (DateTime) + + DateTime (); + + friend bool operator < (const DateTime& d0, const DateTime& d1); + friend bool operator == (const DateTime& d0, const DateTime& d1); + friend bool operator != (const DateTime& d0, const DateTime& d1) { return !(d0 == d1); } +}; + +template<class TransferFunction> +void DateTime::Transfer (TransferFunction& transfer) +{ + TRANSFER (highSeconds); + TRANSFER (fraction); + TRANSFER (lowSeconds); +} + +void ByteSwapDateTime (DateTime& dateTime); |