-
Notifications
You must be signed in to change notification settings - Fork 0
/
datetime.h
51 lines (45 loc) · 955 Bytes
/
datetime.h
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
46
47
48
49
50
51
#pragma once
#pragma warning(disable:4996)
#ifndef DATE_TIME_H
#define DATE_TIME_H
#include <cstdint>
#include <string>
#include <time.h>
#include <sys/types.h>
#include <time.h>
typedef struct {
uint16_t year;
uint16_t month;
uint16_t day;
} Date;
typedef struct {
uint16_t hour;
uint16_t minute;
uint16_t second;
} Time;
class DateTime {
public:
DateTime();
DateTime(uint16_t year, uint16_t month, uint16_t day, uint16_t hour, uint16_t minute, uint16_t second);
DateTime(uint16_t hour, uint16_t minute, uint16_t second);
std::string ToString();
uint32_t GetUNIXd();
::Date getDate();
::Time getTime();
void Now();
bool operator == (DateTime t);
bool operator != (DateTime t);
bool operator > (DateTime t);
bool operator < (DateTime t);
bool operator >= (DateTime t);
bool operator <= (DateTime t);
private:
uint16_t Year;
uint16_t Month;
uint16_t Day;
uint16_t Hour;
uint16_t Minute;
uint16_t Second;
protected:
};
#endif