Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: net/der/parse_values.cc

Issue 2075783002: Adding additional comparison operators for GeneralizedTime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/der/parse_values.h ('k') | net/der/parse_values_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/der/parse_values.cc
diff --git a/net/der/parse_values.cc b/net/der/parse_values.cc
index a2df4b8af650122f18711613c127200947483e2c..903daafdc0d7221e29607486f46e6064c795564e 100644
--- a/net/der/parse_values.cc
+++ b/net/der/parse_values.cc
@@ -284,6 +284,18 @@ bool operator<(const GeneralizedTime& lhs, const GeneralizedTime& rhs) {
rhs.hours, rhs.minutes, rhs.seconds);
}
+bool operator>(const GeneralizedTime& lhs, const GeneralizedTime& rhs) {
+ return rhs < lhs;
+}
+
+bool operator<=(const GeneralizedTime& lhs, const GeneralizedTime& rhs) {
+ return !(lhs > rhs);
+}
+
+bool operator>=(const GeneralizedTime& lhs, const GeneralizedTime& rhs) {
+ return !(lhs < rhs);
+}
+
// A UTC Time in DER encoding should be YYMMDDHHMMSSZ, but some CAs encode
// the time following BER rules, which allows for YYMMDDHHMMZ. If the length
// is 11, assume it's YYMMDDHHMMZ, and in converting it to a GeneralizedTime,
« no previous file with comments | « net/der/parse_values.h ('k') | net/der/parse_values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698