ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
gps_time.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::gps {
8
9class GPSTime : public time::RealTimeClock, public GPSListener {
10 public:
11 void update() override { this->from_tiny_gps_(this->get_tiny_gps()); };
12 void on_update(TinyGPSPlus &tiny_gps) override {
13 if (!this->has_time_) {
14 this->from_tiny_gps_(tiny_gps);
15 }
16 }
17
18 protected:
19 void from_tiny_gps_(TinyGPSPlus &tiny_gps);
20 bool has_time_{false};
21};
22
23} // namespace esphome::gps
TinyGPSPlus & get_tiny_gps()
Definition gps.cpp:8
void from_tiny_gps_(TinyGPSPlus &tiny_gps)
Definition gps_time.cpp:8
void on_update(TinyGPSPlus &tiny_gps) override
Definition gps_time.h:12
void update() override
Definition gps_time.h:11
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.