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-08 14:49:01 (GMT)
commit74c9eb96554825165dd9151aa8c5e241b94c59a9 (patch)
tree6578d28cf3835f7522f8e4bb96b68d32608ffcac /src/components/datetime/DateTimeController.h
parente721c71153d68578e6428c58c6a31698337f7d71 (diff)
Streamline datetime code, adjust precision to the one actually used
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;