Skip to content

Instantly share code, notes, and snippets.

@danlentz
Forked from raspasov/gist:c3a45a669b74de717050
Last active August 29, 2015 14:14
Show Gist options
  • Save danlentz/288fdc10e4f682f4b10e to your computer and use it in GitHub Desktop.
Save danlentz/288fdc10e4f682f4b10e to your computer and use it in GitHub Desktop.
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