• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calendar.getInstance.getTimeInMillis() Vs System.currentTimeMillis()  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calendar.getInstance.getTimeInMillis() is similar to System.currentTimeMillis(). Both are giving long values. Which gives good performace than others. I am planning to use this for audit purpose.
 
Rob Camick
Ranch Hand
Posts: 2828
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of use don't bother with micro optimization.

Why don't you create a simple program using each method in a loop and then report back on your findings.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under the covers, the Calendar classes uses the System.currentTimeMillis() method call to create a Calendar class with the current time. If all you want is the current time in millis, it's probably better to call the System class directly.

But I agree with Rob. This is unlikely to make any difference, and you should only optimize if you first confirm that its an issue first.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!