diff --git a/.gitmodules b/.gitmodules
index 3902644c..8d302ae7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,6 +7,3 @@
[submodule "src/libs/QCBOR"]
path = src/libs/QCBOR
url = https://github.com/laurencelundblade/QCBOR.git
-[submodule "src/libs/date"]
- path = src/libs/date
- url = https://github.com/HowardHinnant/date.git
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 95846a9b..4fcbb16f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -658,14 +658,6 @@ set(INCLUDE_FILES
drivers/Cst816s.h
FreeRTOS/portmacro.h
FreeRTOS/portmacro_cmsis.h
- libs/date/include/date/tz.h
- libs/date/include/date/chrono_io.h
- libs/date/include/date/date.h
- libs/date/include/date/islamic.h
- libs/date/include/date/iso_week.h
- libs/date/include/date/julian.h
- libs/date/include/date/ptz.h
- libs/date/include/date/tz_private.h
displayapp/LittleVgl.h
displayapp/InfiniTimeTheme.h
systemtask/SystemTask.h
@@ -690,7 +682,6 @@ include_directories(
include_directories(SYSTEM
libs/
FreeRTOS/
- libs/date/include
libs/mynewt-nimble/porting/npl/freertos/include
libs/mynewt-nimble/nimble/include
libs/mynewt-nimble/porting/nimble/include
diff --git a/src/components/ble/weather/WeatherService.cpp b/src/components/ble/weather/WeatherService.cpp
index e606d9bf..fd13f819 100644
--- a/src/components/ble/weather/WeatherService.cpp
+++ b/src/components/ble/weather/WeatherService.cpp
@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+#include
#include
#include "WeatherService.h"
#include "libs/QCBOR/inc/qcbor/qcbor.h"
diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h
index 8e3fa8ff..04c53bb8 100644
--- a/src/components/datetime/DateTimeController.h
+++ b/src/components/datetime/DateTimeController.h
@@ -67,6 +67,10 @@ namespace Pinetime {
return static_cast(daysSinceSunday);
}
+ uint8_t DayOfYear() const {
+ return localTime.tm_yday + 1;
+ }
+
uint8_t Hours() const {
return localTime.tm_hour;
}
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index f955c213..09111865 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -1,6 +1,5 @@
#pragma once
#include
-#include
#include
#include
#include
diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h
index e30334a6..7be0c6d8 100644
--- a/src/displayapp/DisplayAppRecovery.h
+++ b/src/displayapp/DisplayAppRecovery.h
@@ -7,7 +7,6 @@
#include
#include "components/gfx/Gfx.h"
#include "drivers/Cst816s.h"
-#include
#include
#include
#include "BootErrors.h"
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index 73c2ab9b..a03dc68b 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -1,6 +1,5 @@
#include "displayapp/screens/Clock.h"
-#include
#include
#include "components/battery/BatteryController.h"
#include "components/motion/MotionController.h"
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index 9e05af51..511ecf50 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -1,4 +1,5 @@
#include
+#include
#include
#include "displayapp/screens/SystemInfo.h"
#include
diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp
index d6f66ed0..b030e3b0 100644
--- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp
+++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp
@@ -1,6 +1,5 @@
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
-#include
#include
#include
#include "displayapp/screens/BatteryIcon.h"
@@ -225,19 +224,14 @@ void WatchFaceCasioStyleG7710::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
if (currentDateTime.IsUpdated()) {
- auto newDateTime = currentDateTime.Get();
+ auto hour = dateTimeController.Hours();
+ auto minute = dateTimeController.Minutes();
+ auto year = dateTimeController.Year();
+ auto month = dateTimeController.Month();
+ auto dayOfWeek = dateTimeController.DayOfWeek();
+ auto day = dateTimeController.Day();
+ auto dayOfYear = dateTimeController.DayOfYear();
- auto dp = date::floor(newDateTime);
- auto time = date::make_time(newDateTime - dp);
- auto yearMonthDay = date::year_month_day(dp);
-
- auto year = static_cast(yearMonthDay.year());
- auto month = static_cast(static_cast(yearMonthDay.month()));
- auto day = static_cast(yearMonthDay.day());
- auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding());
-
- uint8_t hour = time.hours().count();
- uint8_t minute = time.minutes().count();
auto weekNumberFormat = "%V";
if (displayedHour != hour || displayedMinute != minute) {
@@ -278,22 +272,19 @@ void WatchFaceCasioStyleG7710::Refresh() {
// first day of week 1; days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
}
- uint8_t weekNumber;
- uint16_t dayOfYearNumber, daysTillEndOfYearNumber;
-
time_t ttTime =
std::chrono::system_clock::to_time_t(std::chrono::time_point_cast(currentDateTime.Get()));
tm* tmTime = std::localtime(&ttTime);
- dayOfYearNumber = tmTime->tm_yday + 1; // tm_yday day of year [0,365] => yday+1
- daysTillEndOfYearNumber = (yearMonthDay.year().is_leap() ? 366 : 365) - dayOfYearNumber;
+ int daysInCurrentYear = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0 ? 366 : 365;
+ uint16_t daysTillEndOfYearNumber = daysInCurrentYear - dayOfYear;
char buffer[8];
strftime(buffer, 8, weekNumberFormat, tmTime);
- weekNumber = atoi(buffer);
+ uint8_t weekNumber = atoi(buffer);
lv_label_set_text_fmt(label_day_of_week, "%s", dateTimeController.DayOfWeekShortToString());
- lv_label_set_text_fmt(label_day_of_year, "%3d-%3d", dayOfYearNumber, daysTillEndOfYearNumber);
+ lv_label_set_text_fmt(label_day_of_year, "%3d-%3d", dayOfYear, daysTillEndOfYearNumber);
lv_label_set_text_fmt(label_week_number, "WK%02d", weekNumber);
lv_obj_realign(label_day_of_week);
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index d33f4b28..ad35b5c9 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -1,6 +1,5 @@
#include "displayapp/screens/WatchFaceDigital.h"
-#include
#include
#include
#include "displayapp/screens/NotificationIcon.h"
@@ -89,19 +88,12 @@ void WatchFaceDigital::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
if (currentDateTime.IsUpdated()) {
- auto newDateTime = currentDateTime.Get();
-
- auto dp = date::floor(newDateTime);
- auto time = date::make_time(newDateTime - dp);
- auto yearMonthDay = date::year_month_day(dp);
-
- auto year = static_cast(yearMonthDay.year());
- auto month = static_cast(static_cast(yearMonthDay.month()));
- auto day = static_cast(yearMonthDay.day());
- auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding());
-
- uint8_t hour = time.hours().count();
- uint8_t minute = time.minutes().count();
+ auto hour = dateTimeController.Hours();
+ auto minute = dateTimeController.Minutes();
+ auto year = dateTimeController.Year();
+ auto month = dateTimeController.Month();
+ auto dayOfWeek = dateTimeController.DayOfWeek();
+ auto day = dateTimeController.Day();
if (displayedHour != hour || displayedMinute != minute) {
displayedHour = hour;
diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp
index 6bd16430..6e854654 100644
--- a/src/displayapp/screens/WatchFaceInfineat.cpp
+++ b/src/displayapp/screens/WatchFaceInfineat.cpp
@@ -1,6 +1,5 @@
#include "displayapp/screens/WatchFaceInfineat.h"
-#include
#include
#include
#include "displayapp/screens/Symbols.h"
@@ -314,19 +313,12 @@ void WatchFaceInfineat::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
if (currentDateTime.IsUpdated()) {
- auto newDateTime = currentDateTime.Get();
-
- auto dp = date::floor(newDateTime);
- auto time = date::make_time(newDateTime - dp);
- auto yearMonthDay = date::year_month_day(dp);
-
- auto year = static_cast(yearMonthDay.year());
- auto month = static_cast(static_cast(yearMonthDay.month()));
- auto day = static_cast(yearMonthDay.day());
- auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding());
-
- int hour = time.hours().count();
- auto minute = time.minutes().count();
+ auto hour = dateTimeController.Hours();
+ auto minute = dateTimeController.Minutes();
+ auto year = dateTimeController.Year();
+ auto month = dateTimeController.Month();
+ auto dayOfWeek = dateTimeController.DayOfWeek();
+ auto day = dateTimeController.Day();
char minutesChar[3];
sprintf(minutesChar, "%02d", static_cast(minute));
diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp
index fc5d1462..19841c15 100644
--- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp
+++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp
@@ -20,7 +20,6 @@
*/
#include "displayapp/screens/WatchFacePineTimeStyle.h"
-#include
#include
#include
#include
@@ -448,20 +447,13 @@ void WatchFacePineTimeStyle::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
if (currentDateTime.IsUpdated()) {
- auto newDateTime = currentDateTime.Get();
-
- auto dp = date::floor(newDateTime);
- auto time = date::make_time(newDateTime - dp);
- auto yearMonthDay = date::year_month_day(dp);
-
- auto year = static_cast(yearMonthDay.year());
- auto month = static_cast(static_cast(yearMonthDay.month()));
- auto day = static_cast(yearMonthDay.day());
- auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding());
-
- uint8_t hour = time.hours().count();
- uint8_t minute = time.minutes().count();
- uint8_t second = time.seconds().count();
+ auto hour = dateTimeController.Hours();
+ auto minute = dateTimeController.Minutes();
+ auto second = dateTimeController.Seconds();
+ auto year = dateTimeController.Year();
+ auto month = dateTimeController.Month();
+ auto dayOfWeek = dateTimeController.DayOfWeek();
+ auto day = dateTimeController.Day();
if (displayedHour != hour || displayedMinute != minute) {
displayedHour = hour;
diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp
index d3534c08..e5ff195e 100644
--- a/src/displayapp/screens/WatchFaceTerminal.cpp
+++ b/src/displayapp/screens/WatchFaceTerminal.cpp
@@ -1,4 +1,3 @@
-#include
#include
#include "displayapp/screens/WatchFaceTerminal.h"
#include "displayapp/screens/BatteryIcon.h"
@@ -108,20 +107,13 @@ void WatchFaceTerminal::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
if (currentDateTime.IsUpdated()) {
- auto newDateTime = currentDateTime.Get();
-
- auto dp = date::floor(newDateTime);
- auto time = date::make_time(newDateTime - dp);
- auto yearMonthDay = date::year_month_day(dp);
-
- auto year = static_cast(yearMonthDay.year());
- auto month = static_cast(static_cast(yearMonthDay.month()));
- auto day = static_cast(yearMonthDay.day());
- auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding());
-
- uint8_t hour = time.hours().count();
- uint8_t minute = time.minutes().count();
- uint8_t second = time.seconds().count();
+ auto hour = dateTimeController.Hours();
+ auto minute = dateTimeController.Minutes();
+ auto second = dateTimeController.Seconds();
+ auto year = dateTimeController.Year();
+ auto month = dateTimeController.Month();
+ auto dayOfWeek = dateTimeController.DayOfWeek();
+ auto day = dateTimeController.Day();
if (displayedHour != hour || displayedMinute != minute || displayedSecond != second) {
displayedHour = hour;
diff --git a/src/libs/date b/src/libs/date
deleted file mode 160000
index 9502bc27..00000000
--- a/src/libs/date
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 9502bc27a3b32fa5759ea82a76c22551620ebcd2