AceTimeClock
1.0.4
Clock classes for Arduino 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(EPOXY_DUINO)
10
11
#include <time.h>
// time()
12
#include <AceTime.h>
// LocalDate
13
#include "Clock.h"
14
15
namespace
ace_time {
16
namespace
clock {
17
21
class
UnixClock
:
public
Clock
{
22
public
:
23
explicit
UnixClock
() {}
24
26
void
setup
() {}
27
28
acetime_t
getNow
()
const override
{
29
return
time(
nullptr
) - LocalDate::kSecondsSinceUnixEpoch;
30
}
31
};
32
33
}
34
}
35
36
#endif
37
38
#endif
ace_time::clock::UnixClock::setup
void setup()
Setup function that currently does nothing.
Definition:
UnixClock.h:26
ace_time::clock::UnixClock
An implementation of Clock that works on Unix using EpoxyDuino.
Definition:
UnixClock.h:21
ace_time::clock::Clock
Abstract base class for objects that provide and store time.
Definition:
Clock.h:19
ace_time::clock::UnixClock::getNow
acetime_t getNow() const override
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
Definition:
UnixClock.h:28
Generated by
1.8.17