Compare the embedded timestamps of the given UUIDs. This is used when it is OK to return
an equality based on timestamps alone
@throws UnsupportedOperationException if either uuid is not a timestamp UUID
422613
public static int compareTimestamps(UUID uuid1, UUID uuid2) {
        return Longs.compare(uuid1.timestamp(), uuid2.timestamp());
    }
9202
def _timestamp_instants_eq(a, b):
    """"""
    assert isinstance(a, datetime)
    if not isinstance(b, datetime):
        return False
    # datetime's __eq__ can't compare a None offset and a non-None offset. For these equivalence semantics, a None
    # offset (unknown local offset) is treated equivalently to a +00:00.
    if a.tzinfo is None:
        a = a.replace(tzinfo=OffsetTZInfo())
    if b.tzinfo is None:
        b = b.replace(tzinfo=OffsetTZInfo())
    # datetime's __eq__ implementation compares instants; offsets and precision need not be equal.
    return a == b
965795
@Override
  public int compareTo(V1Annotation that) {
    if (this == that) return 0;
    int byTimestamp = timestamp < that.timestamp ? -1 : timestamp == that.timestamp ? 0 : 1;
    if (byTimestamp != 0) return byTimestamp;
    return value.compareTo(that.value);
  }
826195
@Override
    public int compareTo(TimestampType dateval) {
        int comp = m_date.compareTo(dateval.m_date);
        if (comp == 0) {
            return m_usecs - dateval.m_usecs;
        }
        else {
            return comp;
        }
    }
1091560
private static boolean timestampToAsofAttributeRelationiship(Map.Entry<Attribute, Attribute> each)
    {
        return (each.getValue() != null && each.getValue().isAsOfAttribute()) && !each.getKey().isAsOfAttribute();
    }
268291
public static String getTimestampForId(String context, String ip) {
    	BDBMap bdbMap = getContextMap(context);
        String dateStr = bdbMap.get(ip);
        return (dateStr != null) ? dateStr : Timestamp.currentTimestamp().getDateStr();
    }
311072
public static boolean sequenceEqualConstantTime(byte[] self, byte[] other) {
        if (self == null) {
            throw new IllegalArgumentException("self");
        }

        if (other == null) {
            throw new IllegalArgumentException("other");
        }

        // Constant time comparison of two byte arrays
        long difference = (self.length & 0xffffffffL) ^ (other.length & 0xffffffffL);

        for (int i = 0; i < self.length && i < other.length; i++) {
            difference |= (self[i] ^ other[i]) & 0xffffffffL;
        }

        return difference == 0;
    }
271344
@Override
    public T get(final UUID _uuid)
    {
        if (!hasEntries()) {
            initialize(AbstractAutomaticCache.class);
        }
        return getCache4UUID().get(_uuid);
    }
1005273
@SuppressWarnings("HiddenField")
  public BaseWindowedBolt withTimestampExtractor(TimestampExtractor timestampExtractor) {
    if (this.timestampExtractor != null) {
      throw new IllegalArgumentException(
          "Window is already configured with a timestamp extractor: " + timestampExtractor);
    }

    this.timestampExtractor = new org.apache.heron.api.windowing.TimestampExtractor() {

      @Override
      public long extractTimestamp(Tuple tuple) {
        return timestampExtractor.extractTimestamp(new TupleImpl(tuple));
      }
    };
    return this;
  }
326179
protected static long getId4UUID(final UUID _typeUUID)
        throws CacheReloadException
    {
        long ret = 0;
        final Cache<UUID, Type> cache = InfinispanCache.get().<UUID, Type>getCache(Type.UUIDCACHE);
        if (cache.containsKey(_typeUUID)) {
            ret = cache.get(_typeUUID).getId();
        } else {
            Connection con = null;
            try {
                con = Context.getConnection();
                PreparedStatement stmt = null;
                try {
                    stmt = con.prepareStatement(Type.SQL_UUID);
                    stmt.setObject(1, _typeUUID.toString());
                    final ResultSet rs = stmt.executeQuery();
                    while (rs.next()) {
                        ret = rs.getLong(1);
                    }
                    rs.close();
                } finally {
                    if (stmt != null) {
                        stmt.close();
                    }
                }
                con.commit();
            } catch (final SQLException e) {
                throw new CacheReloadException("could not read child type ids", e);
            } catch (final EFapsException e) {
                throw new CacheReloadException("could not read child type ids", e);
            } finally {
                try {
                    if (con != null && !con.isClosed()) {
                        con.close();
                    }
                } catch (final SQLException e) {
                    throw new CacheReloadException("could not read child type ids", e);
                }
            }
        }
        return ret;
    }
210051
@Pure
	public BusHub getBusHub(UUID uuid) {
		if (uuid == null) {
			return null;
		}
		for (final BusHub busHub : this.validBusHubs) {
			if (uuid.equals(busHub.getUUID())) {
				return busHub;
			}
		}
		for (final BusHub busHub : this.invalidBusHubs) {
			if (uuid.equals(busHub.getUUID())) {
				return busHub;
			}
		}
		return null;
	}
448817
public static boolean isUnixTimeStamp(String timeStamp) {
    if (timeStamp.length() != ComplianceConfigurationKeys.TIME_STAMP_LENGTH) {
      return false;
    }
    try {
      Long.parseLong(timeStamp);
      return true;
    } catch (NumberFormatException e) {
      return false;
    }
  }
28330
public static boolean isISODateTimeUTC(final String val) throws BadDateException {
    try {
      if (val.length() != 16) {
        return false;
      }
      fromISODateTimeUTC(val);
      return true;
    } catch (Throwable t) {
      return false;
    }
  }
260307
public int compareTo(UUID val) {
		// The ordering is intentionally set up so that the UUIDs
		// can simply be numerically compared as two numbers
		return (this.mostSigBits < val.mostSigBits ? -1 : //
				(this.mostSigBits > val.mostSigBits ? 1 : //
						(this.leastSigBits < val.leastSigBits ? -1 : //
								(this.leastSigBits > val.leastSigBits ? 1 : //
										0))));
	}
318920
def _timestamps_eq(a, b):
    """"""
    assert isinstance(a, datetime)
    if not isinstance(b, datetime):
        return False
    # Local offsets must be equivalent.
    if (a.tzinfo is None) ^ (b.tzinfo is None):
        return False
    if a.utcoffset() != b.utcoffset():
        return False
    for a, b in ((a, b), (b, a)):
        if isinstance(a, Timestamp):
            if isinstance(b, Timestamp):
                # Both operands declare their precisions. They are only equivalent if their precisions are the same.
                if a.precision is b.precision and a.fractional_precision is b.fractional_precision:
                    break
                return False
            elif a.precision is not TimestampPrecision.SECOND or a.fractional_precision != MICROSECOND_PRECISION:
                # Only one of the operands declares its precision. It is only equivalent to the other (a naive datetime)
                # if it has full microseconds precision.
                return False
    return a == b
305439
def observable_timestamp_compare(instance):
    
    for key, obj in instance['objects'].items():
        compares = enums.TIMESTAMP_COMPARE_OBSERVABLE.get(obj.get('type', ''), [])
        print(compares)
        for first, op, second in compares:
            comp = getattr(operator, op)
            comp_str = get_comparison_string(op)

            if first in obj and second in obj and \
                    not comp(obj[first], obj[second]):
                msg = "In object '%s', '%s' (%s) must be %s '%s' (%s)"
                yield JSONError(msg % (key, first, obj[first], comp_str, second, obj[second]),
                                instance['id'])
300721
@Override
    public long get(TemporalUnit unit) {
        if (unit == ChronoUnit.YEARS) {
            return years;
        } else if (unit == ChronoUnit.MONTHS) {
            return months;
        } else if (unit == ChronoUnit.DAYS) {
            return days;
        } else {
            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
        }
    }