From 96c70a245e7386a486ef9a2b69cc57aeae089c4c Mon Sep 17 00:00:00 2001 From: Ruffalo Lavoisier Date: Mon, 16 Sep 2024 16:51:47 +0900 Subject: [PATCH 1/2] Resize param data type - day max value is 31 (need to 8 bit) and month max value is 12 (need to 4 bit), and weekday is 7.. so need to 4 bit --- src/hal/time.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hal/time.cpp b/src/hal/time.cpp index d0ce9cb71..78b79476e 100644 --- a/src/hal/time.cpp +++ b/src/hal/time.cpp @@ -122,14 +122,14 @@ time_t OswHal::getTime(time_t& offset) { return this->getUTCTime() + offset; } -void OswHal::getDate(time_t& offset, uint32_t* day, uint32_t* weekDay) { +void OswHal::getDate(time_t& offset, uint8_t* day, uint8_t* weekDay) { RtcDateTime d = RtcDateTime(); d.InitWithUnix32Time(this->getTime(offset)); *weekDay = d.DayOfWeek(); *day = d.Day(); } -void OswHal::getDate(time_t& offset, uint32_t* day, uint32_t* month, uint32_t* year) { +void OswHal::getDate(time_t& offset, uint8_t* day, uint8_t* month, uint32_t* year) { RtcDateTime d = RtcDateTime(); d.InitWithUnix32Time(this->getTime(offset)); *day = d.Day(); From e05932aced644a80d2fc7229905abb970c8b4004 Mon Sep 17 00:00:00 2001 From: Ruffalo Lavoisier Date: Mon, 16 Sep 2024 17:01:45 +0900 Subject: [PATCH 2/2] Resize param data type --- src/hal/time.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hal/time.cpp b/src/hal/time.cpp index 78b79476e..41d4b3f48 100644 --- a/src/hal/time.cpp +++ b/src/hal/time.cpp @@ -26,7 +26,7 @@ void OswHal::updateTimeProvider() { OSW_LOG_D("No provider for Time is available!"); } -void OswHal::getUTCTime(uint32_t* hour, uint32_t* minute, uint32_t* second) { +void OswHal::getUTCTime(uint8_t* hour, uint8_t* minute, uint8_t* second) { RtcDateTime d = RtcDateTime(); d.InitWithUnix32Time(this->getUTCTime()); *hour = d.Hour(); @@ -34,7 +34,7 @@ void OswHal::getUTCTime(uint32_t* hour, uint32_t* minute, uint32_t* second) { *second = d.Second(); } -void OswHal::getTime(time_t& offset, uint32_t* hour, uint32_t* minute, uint32_t* second, bool* afterNoon) { +void OswHal::getTime(time_t& offset, uint8_t* hour, uint8_t* minute, uint8_t* second, bool* afterNoon) { RtcDateTime d = RtcDateTime(); d.InitWithUnix32Time(this->getTime(offset)); if (!OswConfigAllKeys::timeFormat.get()) {