FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Suggestions
   Software Suggestions
(Moderator: fry)
   millis() and draw()/loop()
« Previous topic | Next topic »

Pages: 1 2 
   Author  Topic: millis() and draw()/loop()  (Read 828 times)
arielm

WWW
Re: millis() and draw()/loop()
« Reply #15 on: Jul 17th, 2003, 11:33pm »

toxi, thanks for the second piece of code with the synchronized example...
 
i've put this page on my todo list, for some rainy day:
http://java.sun.com/docs/books/tutorial/essential/threads/
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: millis() and draw()/loop()
« Reply #16 on: Jul 25th, 2003, 2:55am »

on Jul 17th, 2003, 8:20pm, toxi wrote:
ben why can't we change the current millis() implentation to something like this:
 
public int millis() {
    return (int) (System.currentTimeMillis() - millisOffset);
}
 
this will always return up-to-date values and keep all the other advantages you mentioned. no

yeah, though it's slow. you're calling out to a native function with currentTimeMillis, which returns 8 bytes (oog, that's bigger than our processors are happy with!) and then subtracting that from another stored 8 byte number, then casting it all down to an int. at least that was my initial impression.  
 
however, maybe in the basic case, this doesn't really matter--since we're either calling it once per loop, in which case it's fine, or getting the extra resolution, which is slower, but it works where it didn't before.  
 
errr.. if that makes sense. hm, just ate my once monthly pile of fried food and it seems to have constricted too many of the blood vessels leadin to me 'noggin.
 
fry


WWW
Re: millis() and draw()/loop()
« Reply #17 on: Jul 25th, 2003, 3:05am »

okok, implemented for 57.
 
 
toxi

WWW
Re: millis() and draw()/loop()
« Reply #18 on: Jul 25th, 2003, 12:32pm »

uncle fry, you da man!
 
heck, i just realised the coincidence between your name and choice of food! but do we need your brains here, be careful!
 

http://toxi.co.uk/
Pages: 1 2 

« Previous topic | Next topic »