Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with timer  RSS feed

Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two computers, laptop and a PC I noticed when using Timer class to create animations that it moves faster on my laptop than on my PC. I did a little test and found out that I was right. Below is the code I used for this test.

Basicly it adds the actual delay time into an array, then it prints out the average time.

I found that on my laptop the average time is 20 - 25 ms, but on my PC it is 40 - 45. Why is that?

I did another test using Thread:

This time the average time on both computers is around 20 ms, as it should be. Im in a dilemma should I change the code of my animation to use Thread instead of the Timer class, that would mean some extra work or try to figure out why the Timer class behaves like that.
[ September 15, 2005: Message edited by: Unnar Bj�rnsson ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!