orc.util
Class TimeSync

java.lang.Object
  extended by orc.util.TimeSync

public class TimeSync
extends java.lang.Object


Field Summary
 double last_sync_error
           
 int resync_count
           
 
Constructor Summary
TimeSync(double device_ticks_per_second, long device_ticks_wrap, double rate_error, double reset_time)
           
 
Method Summary
 long getHostUtime(long device_ticks_wrapping)
          For the given device_time, estimate the corresponding host utime.
 void update(long host_utime, long device_ticks_wrapping)
          Every host/device pair should be passed to this function, and must occur prior to calling _get_host_utime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

last_sync_error

public double last_sync_error

resync_count

public int resync_count
Constructor Detail

TimeSync

public TimeSync(double device_ticks_per_second,
                long device_ticks_wrap,
                double rate_error,
                double reset_time)
Parameters:
device_ticks_per_second - How fast does the counter on the device count, in Hz?
device_ticks_wrap - After how many ticks does the device counter "roll over"? Use 0 if it does not roll over.
rate_error - What is the rate error? (usually a small number like 0.01)
reset_time - Force a resynchronization if the sync error exceeds this many seconds.
Method Detail

update

public void update(long host_utime,
                   long device_ticks_wrapping)
Every host/device pair should be passed to this function, and must occur prior to calling _get_host_utime


getHostUtime

public long getHostUtime(long device_ticks_wrapping)
For the given device_time, estimate the corresponding host utime. In the case that device_ticks wraps, the most recent possible instance of the device_time is used.