Forums Register Login

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

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
Your buns are mine! But you can have this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 13531 times.
Similar Threads
Date problem
Time Computation
check efficiency
How to convert now date to Timestamp ??
Java Performance Issue
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:55:09.