mirror of
https://github.com/esphome/esphome.git
synced 2026-10-13 01:32:49 +00:00
[template][time] Add template time platform (#14838)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
co-authored by
clydebarrow
parent
b8af6cb005
commit
ea4754e798
@@ -29,7 +29,7 @@ class RealTimeClock : public PollingComponent {
|
||||
ESPTime utcnow() { return ESPTime::from_epoch_utc(this->timestamp_now()); }
|
||||
|
||||
/// Get the current time as the UTC epoch since January 1st 1970.
|
||||
time_t timestamp_now() { return ::time(nullptr); }
|
||||
virtual time_t timestamp_now() { return ::time(nullptr); }
|
||||
|
||||
template<typename F> void add_on_time_sync_callback(F &&callback) {
|
||||
this->time_sync_callback_.add(std::forward<F>(callback));
|
||||
|
||||
Reference in New Issue
Block a user