javax.media.SystemTimeBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fmj Show documentation
Show all versions of fmj Show documentation
Freedom for Media in Java
package javax.media;
/**
* SystemTimeBase implements the default TimeBase.
*
* @see TimeBase
*/
final public class SystemTimeBase implements TimeBase
{
// Pick some offset (start-up time) so the system time won't be
// so huge. The huge numbers overflow floating point operations
// in some cases.
static long offset = System.currentTimeMillis() * 1000000L;
public long getNanoseconds()
{
return (System.currentTimeMillis() * 1000000L) - offset;
}
public Time getTime()
{
return new Time(getNanoseconds());
}
}