aboutsummaryrefslogtreecommitdiffhomepage
path: root/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/util/src/main/java/com/google/protobuf/util/Timestamps.java')
-rw-r--r--java/util/src/main/java/com/google/protobuf/util/Timestamps.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/util/src/main/java/com/google/protobuf/util/Timestamps.java b/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
index d0bac417..13136f30 100644
--- a/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
+++ b/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
@@ -115,6 +115,17 @@ public final class Timestamps {
}
/**
+ * Compares two timestamps. The value returned is identical to what would be returned by:
+ * {@code Timestamps.comparator().compare(x, y)}.
+ *
+ * @return the value {@code 0} if {@code x == y}; a value less than {@code 0} if {@code x < y};
+ * and a value greater than {@code 0} if {@code x > y}
+ */
+ public static int compare(Timestamp x, Timestamp y) {
+ return COMPARATOR.compare(x, y);
+ }
+
+ /**
* Returns true if the given {@link Timestamp} is valid. The {@code seconds} value must be in the
* range [-62,135,596,800, +253,402,300,799] (i.e., between 0001-01-01T00:00:00Z and
* 9999-12-31T23:59:59Z). The {@code nanos} value must be in the range [0, +999,999,999].