-
-
Save danlentz/288fdc10e4f682f4b10e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SystemClock { | |
public static long lastTime = 0; | |
/** | |
* Returns a strictly increasing time in number of 100 ns that passed since Unix Epoch. | |
*/ | |
public static synchronized long getTime() { | |
long time = System.currentTimeMillis() * 10L*1000L; | |
if (time <= lastTime) { | |
lastTime++; | |
time = lastTime; | |
} | |
lastTime = time; | |
return time; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment