AceTime
1.1.2
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
src
ace_time
clock
UnixClock.h
1
/*
2
* MIT License
3
* Copyright (c) 2018 Brian T. Park
4
*/
5
6
#ifndef ACE_TIME_UNIX_CLOCK_H
7
#define ACE_TIME_UNIX_CLOCK_H
8
9
#if defined(UNIX_HOST_DUINO)
10
11
#include <time.h>
// time()
12
#include "Clock.h"
13
#include "../LocalDate.h"
14
15
namespace
ace_time {
16
namespace
clock {
17
21
class
UnixClock:
public
Clock {
22
public
:
23
explicit
UnixClock() {}
24
25
void
setup() {}
26
27
acetime_t getNow()
const override
{
28
return
time(
nullptr
) -
LocalDate::kSecondsSinceUnixEpoch
;
29
}
30
};
31
32
}
33
}
34
35
#endif
36
37
#endif
ace_time::LocalDate::kSecondsSinceUnixEpoch
static const acetime_t kSecondsSinceUnixEpoch
Number of seconds from Unix epoch (1970-01-01 00:00:00Z) to the AceTime epoch (2000-01-01 00:00:00Z).
Definition:
LocalDate.h:69
Generated by
1.8.17