Hello all,
Nikolay, thank you for posting this problem that you are seeing. I get the
same problem when I use this timer in my code and I have no idea what could
be the issue...  If anyone know the reason why or how to improve it, I would
greatly appreciate the answer as well.....
The followinig are some questions that come into my mind:
1. Is there some more occurate timer out there?
2. Could this potentially be because there are many other applications
runnign in the background?
3. Is there someway to turn off those applications?
NOTE: I posted questions 2 and 3 in my earlier post and didn't get a
responses...

Thank you again for all of your help and I greatly appreciate your response.


Sebo

On Mon, Jul 25, 2011 at 11:25 AM, Christophe <
[email protected]> wrote:

> hello Nikolay,
>
> I have updated my code, following your suggestion :
>
> public List<Long> times = new ArrayList<Long>();
> CountDownTimer countDown = new CountDownTimer(Integer.MAX_VALUE, 1000)
> {
>        @Override
>        public void onTick(long millisUntilFinished) {
>                times.add(System.currentTimeMillis());
>        }
>        ....
> };
>
> and after a while I display the time between two call to "onTick" with
> a loop over my list :
>
> for (int i = 1; i < times.size(); i++) {
>        System.out.println(times.get(i) - times.get(i - 1));
> }
>
> And I have something like this :
>
> 07-25 18:18:37.281: INFO/System.out(408): 1034
> 07-25 18:18:37.281: INFO/System.out(408): 1031
> 07-25 18:18:37.281: INFO/System.out(408): 1017
> 07-25 18:18:37.281: INFO/System.out(408): 1018
> 07-25 18:18:37.291: INFO/System.out(408): 1011
> 07-25 18:18:37.291: INFO/System.out(408): 1019
> ...
>
> I'm not expecting the precision of an atomic clock, but the error
> margin here is huge !
>
> On Jul 25, 8:06 pm, Nikolay Elenkov <[email protected]> wrote:
> > On Jul 26, 2011 3:00 AM, "Christophe" <[email protected]>
>  > wrote:
> >
> >
> >
> > > "Log can be expensive" => I have tried to run the same code with a
> > > good old "System.out.println" and the problem is still there.
> >
> > That goes to the same log buffer, so no change is to be expected. Make a
> > list of Long and push currentTimeMillis on each call. Then dump the list
> to
> > log and see what this gives you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to