View Single Post
Old 04-26-2012, 10:43 PM   #7
inameiname
Groupie
inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.inameiname can self-interpret dreams as they happen.
 
Posts: 159
Karma: 20390
Join Date: Feb 2009
Device: none
Quote:
Originally Posted by geekmaster View Post
The getmsec() function calls a system function that actually returns the date and time, but that may not be accurate if your kindle has not been connected to Internet or 3G recently. I just use it to monitor the accurate passage of time, so you could use it that way too. The first time it is called at program startup, it returns value 0; Any call after that is number of milliseconds since program startup, so if you know what time it was when you started, that tells you how many msec since then -- just divide the returned value by 1000 and add to your startup time (seconds). Do not try to keep accurate time with sleep() or usleep() calls. I implemented getmsec() for accurate framerate control, but you can use it to run a clock to. Just do it!

Some of my scripts in the "eink algorithmic art" thread pause the framework and disable screensavers, then resume them at the end. These "Dithermation" programs could use a system() call to do exactly the same thing, but in this case keep the framework running and only stop the screensaver, then restart it at exit.

These programs can run while IN screensaver mode, and in some cases actually run faster that way (not competing with the framework for resources). And if they sleep correctly with very little eink updating (like a clock) they do not eat extra battery. Sleep mode only shows a screensaver image and disables the keyboard -- the kindle basically "sleeps" all the time and the framework only wakes to process events like key presses. That is why the battery can last so long.

Thanks for all the assistance and info above. I actually hadn't been online in a few days, so maybe it was causing the variance between seconds in the clock program. Unfortunately, I am not extremely familiar with how to change the code so make it more accurate, so while I appreciate the dithermation and way to help it, I think I will just leave it as it is.

And I did notice it can be run in screensaver mode, but it does require a little bit of tweaking to work properly.
inameiname is offline   Reply With Quote