[plugin] ReadTimer: interpret the past as a time tomorrow#12985
Conversation
…time tomorrow Fixes koreader#12984.
| then_t.sec = 0 | ||
| local seconds = os.difftime(os.time(then_t), os.time()) | ||
| if seconds < -120 then | ||
| then_t.day = then_t.day + 1 |
There was a problem hiding this comment.
Conveniently, this also works correctly at the end of the month.
> now_t = os.date("*t")
> now_t.day = now_t.day + 33
> print(os.time(now_t))
1738670289
> print(os.date("%x", os.time(now_t)))
02/04/25 # US date format, actually 2025-02-04 :-)| then_t.min = alarm_time.min | ||
| then_t.sec = 0 | ||
| local seconds = os.difftime(os.time(then_t), os.time()) | ||
| if seconds < -120 then |
There was a problem hiding this comment.
I'm inclined to simply make this something like:
| if seconds < -120 then | |
| if seconds <= 0 then |
Combined with dropping the if seconds > 0 then line and everything in the else condition.
There was a problem hiding this comment.
@offset-torque You use the timer as well I believe?
There was a problem hiding this comment.
Thanks for the reminder Frenzie. I opened an issue 2 years ago about the read timer. I just wrote an update to it regarding the changes. I am copying/pasting the message below for your convenience. I am not linking to the issue to avoid crowding with a mention but you were a participant so you should get a notification for this.
Status update
I see that changes are made to the read timer to address the problems in this issue:
-
We now have a dialog (as I suggested), which allows repeating/ending the timer without going into the menu
-
Also now remanining time can be seen in the status bar as roygbyte suggested which I also think is useful
Thanks for these improvements. Our read timer is not an "egg timer" anymore :)
However my main improvement item still remains, regarding the activation of the timer:
It still takes 6 taps per book to activate the read timer. Which means, it has to be activated manually when the user opens a book and this has to be repeated if user opens another book.
It would be nicer if it can be globally set, as I suggested in the main text of this issue and summarized here:
- There should be an option to enable the timer globally which survives restarts and switching books
- If user opens another document, continue counting
- If user suspends the device, reset the timer
To answer your question, you see it still takes 6 taps per book. I am currently using a timer on my phone for this purpose which takes 2 taps per reading session, which is much more convenient (one for opening the app, one for starting the repeating timer).
Fixes #12984.
This change is