Skip to content

[plugin] ReadTimer: interpret the past as a time tomorrow#12985

Merged
Frenzie merged 4 commits into
koreader:masterfrom
Frenzie:12984-readtimer-past-time-is-future
Jan 5, 2025
Merged

[plugin] ReadTimer: interpret the past as a time tomorrow#12985
Frenzie merged 4 commits into
koreader:masterfrom
Frenzie:12984-readtimer-past-time-is-future

Conversation

@Frenzie

@Frenzie Frenzie commented Jan 2, 2025

Copy link
Copy Markdown
Member

Fixes #12984.


This change is Reviewable

@Frenzie Frenzie added the Plugin label Jan 2, 2025
@Frenzie Frenzie added this to the 2025.01 milestone Jan 2, 2025
@Frenzie Frenzie changed the title [plugin] Readtimer: interpret more than two minutes in the past as a time tomorrow [plugin] ReadTimer: interpret more than two minutes in the past as a time tomorrow Jan 2, 2025
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

@Frenzie Frenzie Jan 2, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :-)

Comment thread plugins/readtimer.koplugin/main.lua Outdated
then_t.min = alarm_time.min
then_t.sec = 0
local seconds = os.difftime(os.time(then_t), os.time())
if seconds < -120 then

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to simply make this something like:

Suggested change
if seconds < -120 then
if seconds <= 0 then

Combined with dropping the if seconds > 0 then line and everything in the else condition.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@offset-torque You use the timer as well I believe?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@Frenzie Frenzie merged commit cbe2111 into koreader:master Jan 5, 2025
@Frenzie Frenzie deleted the 12984-readtimer-past-time-is-future branch January 5, 2025 16:04
@Frenzie Frenzie changed the title [plugin] ReadTimer: interpret more than two minutes in the past as a time tomorrow [plugin] ReadTimer: interpret the past as a time tomorrow Jan 5, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Some inconvenient behaviour of read timer plugin

2 participants