com.addc.commons.time.FakeableTimeSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addc-base Show documentation
Show all versions of addc-base Show documentation
The addc-base library supplies classes for creating UUIDs, converting between types, outputting byte arrays with different formats,
support for Julian dates, delay generators, parsing properties files and support for I18N.
package com.addc.commons.time;
/**
* The FakeableTimeSource supplies a time source that allows tampering
*/
public class FakeableTimeSource implements TimeSource {
private long skew;
@Override
public long getCurrentTime() {
return System.currentTimeMillis() + skew;
}
/**
* Add a skew to the current time
*
* @param skew
* The number of milliseconds to skew the time with
*/
public void setSkew(long skew) {
this.skew= skew;
}
}