Skip to content
Green Luo edited this page Jun 29, 2015 · 4 revisions

System utilities

OSGL tool provides expressive way to access system functions.

// old way
long ts = System.currentTimeMillis();
// new way
long ts = _.ms();

// old way
long ns = System.nanoTime();
// new way
long ns = _.ns();
long ns = _.ts();

// old way
String versionStr = System.getProperty("java.specification.version");
int pos = versionStr.lastIndexOf('.');
int version = Integer.parseInt(versionStr.substring(pos + 1));
// new way
int version = _.JAVA_VERSION

Clone this wiki locally