/*** * Sets the NTP timestamp at the given array index. * * @param index index into the byte array. * @param t TimeStamp. */ private void setTimestamp(int index, TimeStamp t) { long ntpTime = (t == null) ? 0 : t.ntpValue(); // copy 64-bits from Long value into 8 x 8-bit bytes of array // one byte at a time shifting 8-bits for each position. for (int i = 7; i >= 0; i--) { buf[index + i] = (byte) (ntpTime & 0xFF); ntpTime >>>= 8; // shift to next byte } // buf[index] |= 0x80; // only set if 1900 baseline.... }
/*** * Compares this object against the specified object. * The result is <code>true</code> if and only if the argument is * not <code>null</code> and is a <code>Long</code> object that * contains the same <code>long</code> value as this object. * * @param obj the object to compare with. * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. */ @Override public boolean equals(Object obj) { if (obj instanceof TimeStamp) { return ntpTime == ((TimeStamp) obj).ntpValue(); } return false; }
if (origNtpTime.ntpValue() == 0) if (xmitNtpTime.ntpValue() != 0) _comments.add("Error: zero orig time -- cannot compute delay/offset"); } else if (rcvNtpTime.ntpValue() == 0 || xmitNtpTime.ntpValue() == 0) { _comments.add("Warning: zero rcvNtpTime or xmitNtpTime"); if (rcvNtpTime.ntpValue() != 0) } else if (xmitNtpTime.ntpValue() != 0)
/*** * Sets the NTP timestamp at the given array index. * * @param index index into the byte array. * @param t TimeStamp. */ private void setTimestamp(int index, TimeStamp t) { long ntpTime = (t == null) ? 0 : t.ntpValue(); // copy 64-bits from Long value into 8 x 8-bit bytes of array // one byte at a time shifting 8-bits for each position. for (int i = 7; i >= 0; i--) { buf[index + i] = (byte) (ntpTime & 0xFF); ntpTime >>>= 8; // shift to next byte } // buf[index] |= 0x80; // only set if 1900 baseline.... }
/*** * Sets the NTP timestamp at the given array index. * * @param index index into the byte array. * @param t TimeStamp. */ private void setTimestamp(int index, TimeStamp t) { long ntpTime = (t == null) ? 0 : t.ntpValue(); // copy 64-bits from Long value into 8 x 8-bit bytes of array // one byte at a time shifting 8-bits for each position. for (int i = 7; i >= 0; i--) { buf[index + i] = (byte) (ntpTime & 0xFF); ntpTime >>>= 8; // shift to next byte } // buf[index] |= 0x80; // only set if 1900 baseline.... }
/*** * Compares this object against the specified object. * The result is <code>true</code> if and only if the argument is * not <code>null</code> and is a <code>Long</code> object that * contains the same <code>long</code> value as this object. * * @param obj the object to compare with. * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. */ @Override public boolean equals(Object obj) { if (obj instanceof TimeStamp) { return ntpTime == ((TimeStamp) obj).ntpValue(); } return false; }
/*** * Compares this object against the specified object. * The result is <code>true</code> if and only if the argument is * not <code>null</code> and is a <code>Long</code> object that * contains the same <code>long</code> value as this object. * * @param obj the object to compare with. * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. */ public boolean equals(Object obj) { if (obj instanceof TimeStamp) { return ntpTime == ((TimeStamp) obj).ntpValue(); } return false; }
@Override @SneakyThrows public long getPhysicalTime() { return getTimestamp().ntpValue(); }
@Override @SneakyThrows public long getPhysicalTime() { return getTimestamp().ntpValue(); }
public HybridTimestamp(PhysicalTimeProvider physicalTimeProvider) { this(physicalTimeProvider, new TimeStamp(new Date(0)).ntpValue(), 0); }
public HybridTimestamp(PhysicalTimeProvider physicalTimeProvider) { this(physicalTimeProvider, new TimeStamp(new Date(0)).ntpValue(), 0); }