Created
January 31, 2015 22:03
-
-
Save raspasov/c3a45a669b74de717050 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