Methods Summary |
---|
public static long | getCurrentTime()
return( instance.getTime());
|
public static long | getHighPrecisionCounter()
if ( high_precision_counter == null ){
AEDiagnostics.load15Stuff();
synchronized( SystemTime.class ){
long now = getCurrentTime();
if ( now < hpc_last_time ){
// clock's gone back, by at least
long gone_back_by_at_least = hpc_last_time - now;
// all we can do is move the logical start time back too to ensure that our
// counter doesn't got backwards
hpc_base_time -= gone_back_by_at_least;
}
hpc_last_time = now;
return((now - hpc_base_time) * 1000000 );
}
}else{
return( high_precision_counter.nanoTime());
}
|
public static long | getOffsetTime(long offsetMS)
return instance.getTime() + offsetMS;
|
public static void | main(java.lang.String[] args)
for (int i=0;i<1;i++){
//final int f_i = i;
new Thread()
{
public void
run()
{
/*
Average access_average = Average.getInstance( 1000, 10 );
long last = SystemTime.getCurrentTime();
int count = 0;
while( true ){
long now = SystemTime.getCurrentTime();
long diff = now - last;
System.out.println( "diff=" + diff );
last = now;
access_average.addValue( diff );
count++;
if ( count == 33 ){
System.out.println( "AVERAGE " + f_i + " = " + access_average.getAverage());
count = 0;
}
try{
Thread.sleep( 3 );
}catch( Throwable e ){
}
}
*/
long start = SystemTime.getCurrentTime();
while( true ){
long now = SystemTime.getCurrentTime();
System.out.println( now - start );
try{
Thread.sleep(1000);
}catch( Throwable e ){
}
}
}
}.start();
}
|
public static void | registerClockChangeListener(org.gudy.azureus2.core3.util.SystemTime$consumer c)
synchronized( instance ){
List new_list = new ArrayList( clock_change_list );
new_list.add( c );
clock_change_list = new_list;
}
|
public static void | registerConsumer(org.gudy.azureus2.core3.util.SystemTime$consumer c)
synchronized( instance ){
List new_list = new ArrayList( consumer_list );
new_list.add( c );
consumer_list = new_list;
}
|
public static void | registerHighPrecisionCounter(org.gudy.azureus2.core3.util.SystemTime$highPrecisionCounter counter)
high_precision_counter = counter;
|
public static void | unregisterClockChangeListener(org.gudy.azureus2.core3.util.SystemTime$consumer c)
synchronized( instance ){
List new_list = new ArrayList( clock_change_list );
new_list.remove( c );
clock_change_list = new_list;
}
|
public static void | unregisterConsumer(org.gudy.azureus2.core3.util.SystemTime$consumer c)
synchronized( instance ){
List new_list = new ArrayList( consumer_list );
new_list.remove( c );
consumer_list = new_list;
}
|
public static void | useRawProvider()
try{
if ( System.getProperty( "azureus.time.use.raw.provider", "0" ).equals("1")){
instance = new RawProvider();
}else{
instance = new SteppedProvider();
}
}catch( Throwable e ){
// might be in applet...
instance = new SteppedProvider();
}
if ( !( instance instanceof RawProvider )){
instance = new RawProvider();
}
|