summaryrefslogtreecommitdiff
path: root/Runtime/Utilities/DateTime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Utilities/DateTime.cpp')
-rw-r--r--Runtime/Utilities/DateTime.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/Runtime/Utilities/DateTime.cpp b/Runtime/Utilities/DateTime.cpp
new file mode 100644
index 0000000..b95e06c
--- /dev/null
+++ b/Runtime/Utilities/DateTime.cpp
@@ -0,0 +1,45 @@
+#include "UnityPrefix.h"
+#include "DateTime.h"
+#include "Runtime/Serialize/SwapEndianBytes.h"
+
+
+DateTime::DateTime ()
+{
+ highSeconds = 0;
+ lowSeconds = 0;
+ fraction = 0;
+}
+
+bool operator < (const DateTime& d0, const DateTime& d1)
+{
+ if (d0.highSeconds < d1.highSeconds)
+ return true;
+ else if (d0.highSeconds > d1.highSeconds)
+ return false;
+
+ if (d0.lowSeconds < d1.lowSeconds)
+ return true;
+ else if (d0.lowSeconds > d1.lowSeconds)
+ return false;
+
+ return d0.fraction < d1.fraction;
+}
+
+bool operator == (const DateTime& d0, const DateTime& d1)
+{
+ if (d0.highSeconds != d1.highSeconds)
+ return false;
+
+ if (d0.lowSeconds != d1.lowSeconds)
+ return false;
+
+ return d0.fraction == d1.fraction;
+}
+
+
+void ByteSwapDateTime (DateTime& dateTime)
+{
+ SwapEndianBytes(dateTime.highSeconds);
+ SwapEndianBytes(dateTime.fraction);
+ SwapEndianBytes(dateTime.lowSeconds);
+}