| Author |
Calendar.getInstance.getTimeInMillis() Vs System.currentTimeMillis()
|
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1303
|
|
|
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
Joined: Jun 13, 2009
Posts: 1808
|
|
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
Joined: Sep 28, 2004
Posts: 16810
|
|
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
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: Calendar.getInstance.getTimeInMillis() Vs System.currentTimeMillis()
|
|
|