summaryrefslogtreecommitdiff
path: root/Runtime/Utilities/DateTime.cpp
blob: b95e06cdff2ea632e6c8c8de998368e4d39851a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
}