Skip to content

Commit cc3d9d2

Browse files
committed
chrono: Resolve TODOs related to C++20 chrono feats
1 parent c2c53bc commit cc3d9d2

10 files changed

+10
-15
lines changed

src/displayapp/screens/WatchFaceAnalog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void WatchFaceAnalog::Refresh() {
256256
if (currentDateTime.IsUpdated()) {
257257
UpdateClock();
258258

259-
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
259+
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
260260
if (currentDate.IsUpdated()) {
261261
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
262262
}

src/displayapp/screens/WatchFaceAnalog.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ namespace Pinetime {
4343
Utility::DirtyValue<bool> bleState {};
4444
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
4545
Utility::DirtyValue<bool> notificationState {false};
46-
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
47-
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
46+
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
4847

4948
lv_obj_t* minor_scales;
5049
lv_obj_t* major_scales;

src/displayapp/screens/WatchFaceCasioStyleG7710.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void WatchFaceCasioStyleG7710::Refresh() {
244244
}
245245
lv_obj_realign(label_time);
246246

247-
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
247+
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
248248
if (currentDate.IsUpdated()) {
249249
const char* weekNumberFormat = "%V";
250250

src/displayapp/screens/WatchFaceCasioStyleG7710.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ namespace Pinetime {
5151
Utility::DirtyValue<uint8_t> heartbeat {};
5252
Utility::DirtyValue<bool> heartbeatRunning {};
5353
Utility::DirtyValue<bool> notificationState {};
54-
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
55-
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
54+
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
5655

5756
lv_point_t line_icons_points[3] {{0, 5}, {117, 5}, {122, 0}};
5857
lv_point_t line_day_of_week_number_points[4] {{0, 0}, {100, 0}, {95, 95}, {0, 95}};

src/displayapp/screens/WatchFaceDigital.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void WatchFaceDigital::Refresh() {
125125
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
126126
}
127127

128-
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
128+
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
129129
if (currentDate.IsUpdated()) {
130130
uint16_t year = dateTimeController.Year();
131131
uint8_t day = dateTimeController.Day();

src/displayapp/screens/WatchFaceDigital.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ namespace Pinetime {
5454
Utility::DirtyValue<bool> notificationState {};
5555
Utility::DirtyValue<std::optional<Pinetime::Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {};
5656

57-
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
58-
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
57+
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
5958

6059
lv_obj_t* label_time;
6160
lv_obj_t* label_time_ampm;

src/displayapp/screens/WatchFaceInfineat.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ void WatchFaceInfineat::Refresh() {
423423
lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
424424
}
425425

426-
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
426+
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
427427
if (currentDate.IsUpdated()) {
428428
uint8_t day = dateTimeController.Day();
429429
lv_label_set_text_fmt(labelDate, "%s %02d", dateTimeController.DayOfWeekShortToStringLow(), day);

src/displayapp/screens/WatchFaceInfineat.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ namespace Pinetime {
5555
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
5656
Utility::DirtyValue<uint32_t> stepCount {};
5757
Utility::DirtyValue<bool> notificationState {};
58-
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
59-
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
58+
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
6059

6160
// Lines making up the side cover
6261
lv_obj_t* lineBattery;

src/displayapp/screens/WatchFaceTerminal.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void WatchFaceTerminal::Refresh() {
125125
lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second);
126126
}
127127

128-
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
128+
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
129129
if (currentDate.IsUpdated()) {
130130
uint16_t year = dateTimeController.Year();
131131
Controllers::DateTime::Months month = dateTimeController.Month();

src/displayapp/screens/WatchFaceTerminal.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ namespace Pinetime {
4545
Utility::DirtyValue<uint8_t> heartbeat {};
4646
Utility::DirtyValue<bool> heartbeatRunning {};
4747
Utility::DirtyValue<bool> notificationState {};
48-
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
49-
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
48+
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
5049

5150
lv_obj_t* label_time;
5251
lv_obj_t* label_date;

0 commit comments

Comments
 (0)