timers: add hour to countdown timer
A small change to add an hour selector to the timer countdown. I found only being able to set minutes too limiting and sometimes need timers that go longer than 1 hour.
Testing
I’ve tested this in InfiniSim and on the pinetime.
- Build and open up infinisim with this branch checked out
- Navigate to the timer app
- Expected you see H : M : S selectors, all on 0
- Set H to 1 M to 0 and S to 1
- Start the timer
- After ticking down the timer should tick down to 0:59:59
- Pause the timer.
- Set minutes to 50 and start the timer
- Expected previous functionality works as expected and there are no regresions.
I also have another change, unrelated to the timer, because I was having issues building the chrono on Mac.
currentDateTime += std::chrono::seconds(correctedDelta);
uptime += std::chrono::seconds(correctedDelta);
std::time_t currentTime = std::chrono::system_clock::to_time_t(
std::chrono::time_point_cast<std::chrono::system_clock::duration>(currentDateTime));
localTime = *std::localtime(¤tTime);
auto minute = Minutes();
Using the time_point_cast resolved the issue for me, but I haven’t tested it on linux so can’t guarantee it still works there, which is why I didn’t include it as part of this MR. Has this issue been raised before?
Build size and comparison to main:
| Section | Size | Difference |
|---|---|---|
| text | 382620B | 192B |
| data | 944B | 0B |
| bss | 22632B | 0B |
If you build the code using the docker container you should be able to verify your additional fix under Linux.
Do you have an explanation for why you encountered the problem under macOS? What is the problem there?
If you build the code using the docker container you should be able to verify your additional fix under Linux.
Do you have an explanation for why you encountered the problem under macOS? What is the problem there?
Yes, I’ve built the code under the docker container and it was working fine, in fact that’s the one I sent to the watch. I just tried removing the block I have locally for the mac compilation, but now it’s building fine, even after wiping the build, so I can’t reproduce the error I was seeing. Anyway, I didn’t include it as part of the MR because I wasn't sure it wasn’t just a ‘me’ issue.
Please fix the formatting error. Overall the code looks good to me, but I haven't tested it.