aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ble
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2024-01-02 12:27:16 +0100
committerJF <JF002@users.noreply.github.com>2024-01-04 13:00:01 +0100
commitb4ff1f9ca24fa7ca7d89000cbd1402d120b0054e (patch)
tree353808990a7904f3742055208967e656870d9a3b /src/components/ble
parent9b36afc7878e05e7d37ba48b77f7bc95c44c6ee6 (diff)
Simple Weather Service : Fix timestamp
In the documentation, specify that the timestamp is expressed in seconds from epoch (instead of nanoseconds). SimpleWeatherService now uses "localtime" (GetCurrentDateTime()) instead of UTC time.
Diffstat (limited to 'src/components/ble')
-rw-r--r--src/components/ble/SimpleWeatherService.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/ble/SimpleWeatherService.cpp b/src/components/ble/SimpleWeatherService.cpp
index 886bf659..d545d45b 100644
--- a/src/components/ble/SimpleWeatherService.cpp
+++ b/src/components/ble/SimpleWeatherService.cpp
@@ -127,7 +127,7 @@ int SimpleWeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
std::optional<SimpleWeatherService::CurrentWeather> SimpleWeatherService::Current() const {
if (currentWeather) {
- auto currentTime = dateTimeController.UTCDateTime().time_since_epoch();
+ auto currentTime = dateTimeController.CurrentDateTime().time_since_epoch();
auto weatherTpSecond = std::chrono::seconds {currentWeather->timestamp};
auto weatherTp = std::chrono::duration_cast<std::chrono::seconds>(weatherTpSecond);
auto delta = currentTime - weatherTp;
@@ -141,7 +141,7 @@ std::optional<SimpleWeatherService::CurrentWeather> SimpleWeatherService::Curren
std::optional<SimpleWeatherService::Forecast> SimpleWeatherService::GetForecast() const {
if (forecast) {
- auto currentTime = dateTimeController.UTCDateTime().time_since_epoch();
+ auto currentTime = dateTimeController.CurrentDateTime().time_since_epoch();
auto weatherTpSecond = std::chrono::seconds {forecast->timestamp};
auto weatherTp = std::chrono::duration_cast<std::chrono::seconds>(weatherTpSecond);
auto delta = currentTime - weatherTp;