forked from probonopd/TimeLord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimeLord.h
50 lines (43 loc) · 1.02 KB
/
TimeLord.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
extern "C" {
#include <inttypes.h>
#include <math.h>
}
#define tl_second 0
#define tl_minute 1
#define tl_hour 2
#define tl_day 3
#define tl_month 4
#define tl_year 5
class TimeLord{
public:
TimeLord();
// configuration
bool Position(float, float);
bool TimeZone(int);
bool DstRules(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t);
// Political
void GMT(uint8_t *);
void DST(uint8_t *);
//Solar & Astronomical
bool SunRise(uint8_t *);
bool SunSet(uint8_t *);
float MoonPhase(uint8_t *);
void Sidereal(uint8_t *, bool);
uint8_t Season(uint8_t *);
// Utility
uint8_t DayOfWeek(uint8_t *);
uint8_t LengthOfMonth(uint8_t *);
bool IsLeapYear(int);
// these were private
void Adjust(uint8_t *, long);
long DayNumber(uint16_t, uint8_t, uint8_t);
bool InDst(uint8_t *);
private:
float latitude, longitude;
int timezone;
uint8_t dstm1, dstw1, dstm2, dstw2, dstadv;
bool ComputeSun(uint8_t *, bool);
char Signum(int);
int Absolute(int);
uint8_t _season(uint8_t *);
};