Skip to content

Instantly share code, notes, and snippets.

@jentfoo
Created May 10, 2016 19:34
Show Gist options
  • Save jentfoo/fac286698ad8954948232e8c32051e93 to your computer and use it in GitHub Desktop.
Save jentfoo/fac286698ad8954948232e8c32051e93 to your computer and use it in GitHub Desktop.
Threadly guava ticker
import org.threadly.util.Clock;
import com.google.common.base.Ticker;
/**
* Adapter between guava's {@link Ticker} and threadly's {@link Clock}.
*/
public class ThreadlyTicker extends Ticker {
public static final ThreadlyTicker INSTANCE = new ThreadlyTicker();
@Override
public long read() {
return Clock.lastKnownTimeNanos();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment