redtimer icon indicating copy to clipboard operation
redtimer copied to clipboard

Stop timer at suspend my laptop

Open tyunn opened this issue 9 years ago • 3 comments

Hi! Your Redtimer is a perfect apps! Thank you!

I found, that my redtimer still count time during sleep my laptop, but at this time I'm not working on project and stop timer manually is not conveniently. What are you think about this issue? Thank you!

tyunn avatar Nov 24 '16 03:11 tyunn

Hi

Thank you very much for your assessment!

Generally speaking, there are two approaches to calculate a counter:

  1. Remember the time when the timer has been started. When the timer has been stopped, calculate the difference of stop and start time. This difference is the tracked time.

  2. Each second, increase an internal counter by 1. When the timer has been stopped, the internal counter contains the tracked time in seconds.

In the first approach, there is no way finding out whether the laptop had been sent to sleep. In the second approach, sleep times are never calculated.

RedTimer until and including version 1.1 used the second approach. This had some disadvantages (at least in my daily routine):

  • When you are not working on the computer (for example, reading task-related information in a book or discussing with a colleague) and your computer goes to sleep, the time would no longer be tracked.

  • On macOS, there is something called App Nap which will send a program to sleep as soon as it is completely covered by other windows.

  • You need to have a quite accurate timer running in the background at all time which increases power-consumption.

Due to these problems, I switched to the first approach starting with RedTimer 1.2.

Still, I understand your struggle. I suggest that in RedTimer 1.2.1, I will add a switch to choose the approach to use. Then, you will be able to unselect a checkbox "Track time during sleep" and the first approach will be used. Does this sound good to you?

Best regards Frederick Thomssen

fathomssen avatar Nov 24 '16 08:11 fathomssen

Ok, now I understand two way of solution.

Then, you will be able to unselect a checkbox "Track time during sleep" and the first approach will be used. Does this sound good to you?

Yes, looks good. Waiting for a new version! Thank you!

tyunn avatar Nov 24 '16 08:11 tyunn

Solution to stop macOS App Nap: https://stackoverflow.com/questions/30686488/qapplication-is-lazy-or-making-other-threads-lazy-in-the-app

fathomssen avatar Jul 24 '17 05:07 fathomssen