This site requires JavaScript, please enable it in your browser!
Greenfoot back
DarkMageCkmario
DarkMageCkmario wrote ...

2014/3/22

I have a request, and it seems unusual I haven't found much for it yet

DarkMageCkmario DarkMageCkmario

2014/3/22

#
I would like a countup timer, and i have nooooo idea how to make one. All of the things I've seen on the nets here are countDOWN timers, and I don't know how they work either. Thanks in Advance, DMGCK
bourne bourne

2014/3/22

#
Well a countup/countdown timers are almost identical. The method:
System.currentTimeMillis()
returns a long type value that represents the systems time in milliseconds. So whenever your timer starts, record this value to know at what time your timer began. Something like this:
long timeBegan = System.currentTimeMillis();
Then to tell how much time has passed since the timer started, do something like this:
long currentTime = System.currentTimeMillis();
int secondsPassed = (currentTime - timeBegan) / 1000;
DarkMageCkmario DarkMageCkmario

2014/3/22

#
that's true, I did find a countup timer to steal, (which I did) but it's still Eldritch Magic how it works to me.
You need to login to post a reply.