public static void calibrateNanosConversion(){
  long originalMillis=System.currentTimeMillis();
  long updatedMillis=originalMillis;
  while (originalMillis == updatedMillis) {
    updatedMillis=System.currentTimeMillis();
  }
  referenceNanos=System.nanoTime();
  referenceMillis=updatedMillis;
  secondsOffset=millisToSeconds(referenceMillis) - (double)referenceNanos / (double)NANOS_IN_SECOND;
}

public static void calibrateNanosConversion ( ) { long originalMillis = System . currentTimeMillis ( ) ; long updatedMillis = originalMillis ; while ( originalMillis == updatedMillis ) { updatedMillis = System . currentTimeMillis ( ) ; } referenceNanos = System . nanoTime ( ) ; referenceMillis = updatedMillis ; secondsOffset = millisToSeconds ( referenceMillis ) - ( double ) referenceNanos / ( double ) NANOS_IN_SECOND ; }
aligns the nano seconds to the start of a new millisecond . this should be called whenever device wakes up from sleep .
