From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai <chaifix@163.com> Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Utilities/DateTime.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Runtime/Utilities/DateTime.h (limited to 'Runtime/Utilities/DateTime.h') 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); -- cgit v1.1-26-g67d0