summaryrefslogtreecommitdiff
path: root/src/components/datetime/DateTimeController.h
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-07 13:45:14 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-10 05:19:04 (GMT)
commitec484c7b0c4e36ee8b95987866e43c2f447b90b7 (patch)
treeadbb18d20251a2be61872f222bbc53691b0745e1 /src/components/datetime/DateTimeController.h
parentbf92c0326a6c81eb1c344847fd677fccd4171c92 (diff)
Streamline datetime code, adjust precision to the one actually used, save with second precision in noinit section
Diffstat (limited to 'src/components/datetime/DateTimeController.h')
-rw-r--r--src/components/datetime/DateTimeController.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h
index 00bbc2e..cf9d52c 100644
--- a/src/components/datetime/DateTimeController.h
+++ b/src/components/datetime/DateTimeController.h
@@ -65,7 +65,7 @@ namespace Pinetime {
const char* DayOfWeekShortToString() const;
static const char* MonthShortToStringLow(Months month);
- std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> CurrentDateTime() const {
+ std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> CurrentDateTime() const {
return currentDateTime;
}
std::chrono::seconds Uptime() const {
@@ -73,7 +73,7 @@ namespace Pinetime {
}
void Register(System::SystemTask* systemTask);
- void SetCurrentTime(std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> t);
+ void SetCurrentTime(std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> t);
std::string FormattedTime();
private:
@@ -84,9 +84,10 @@ namespace Pinetime {
uint8_t hour = 0;
uint8_t minute = 0;
uint8_t second = 0;
+ uint16_t subsecondTicks = 0;
- uint32_t previousSystickCounter = 0;
- std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> currentDateTime;
+ uint32_t previousSystickCounter = 0; // FIXME: This could probably be 16 bits?
+ std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> currentDateTime;
std::chrono::seconds uptime {0};
bool isMidnightAlreadyNotified = false;