I am writing a game loop in Java and trying to calculator deltas. When attempting to get the current time, the following does not give me an error in my IDE. However the function returning a double, where are System.nanoTime() return a long. Why is this not an error?
private static double getTime() {
return System.nanoTime() / 1000000000;
}
Is explicitly casting to a double better?
private static double getTime() {
return (double) System.nanoTime() / (double) 1000000000;
}