Remove extra overhead from using Calendar class in WALL_CLOCK function
Closed this issue · 1 comments
dniHze commented
The WALL_CLOCK
lambda inside Unearthed class using Calendar
instance to get current epoch time. Calendar
is kinda old the and weighty class to be used for complex time and date related staff computation . And here it's used just to get the current time in milliseconds on WALL_CLOCK
called.
This extra overhead could be easily reduced by using java.lang.System.currentTimeMillis()
method. Actually it's used under the hood of the Calendar
implementations. Some thoughts on each way to get current time in millis and their efficiency could be found in this StackOverflow question.
So the "fixed" version of the WALL_CLOCK
function could be looking like that:
private val WALL_CLOCK = {
System.currentTimeMillis()
}
hannesstruss commented
Fixed via #6