All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.media.SystemTimeBase Maven / Gradle / Ivy

The newest version!
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy