MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / isTimestampAfter

Method isTimestampAfter

src/query/QueryUtil.java:650–661  ·  view source on GitHub ↗

Compares two timestamps where either can be in seconds or milliseconds. @param ts1 The first timestamp in either seconds or milliseconds. @param ts2 The second timestamp in either seconds or milliseconds. @return Whether the first timestamp is after the second

(long ts1, long ts2)

Source from the content-addressed store, hash-verified

648 * @return Whether the first timestamp is after the second
649 */
650 public static boolean isTimestampAfter(long ts1, long ts2) {
651 boolean ts1InSeconds = (ts1 & Const.SECOND_MASK) == 0;
652 boolean ts2InSeconds = (ts2 & Const.SECOND_MASK) == 0;
653
654 if (ts1InSeconds && !ts2InSeconds) {
655 ts1 *= 1000L;
656 } else if (!ts1InSeconds && ts2InSeconds) {
657 ts2 *= 1000L;
658 }
659
660 return ts1 > ts2;
661 }
662}

Callers 2

timestampComparisonMethod · 0.95
splitMethod · 0.95

Calls

no outgoing calls

Tested by 1

timestampComparisonMethod · 0.76