Java getting current date without creating a new Date object -


i have game loops. need check current number of milliseconds. don't want create new date object number of milliseconds has passed. there way current time without creating new date object every iteration of game loop?

example:

date d = new date();  while(true) {     long currenttime = d.getcurrenttime(); } 

in above code, value of currenttime variable continuously change.

rather using date, can access static method

long currenttime = system.currenttimemillis() 

this returns current time of given system in milliseconds.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -