summaryrefslogtreecommitdiff
path: root/indra/llcommon/lldate.h
diff options
context:
space:
mode:
authorKent Quirk <q@lindenlab.com>2009-01-05 18:59:12 +0000
committerKent Quirk <q@lindenlab.com>2009-01-05 18:59:12 +0000
commit667ca55bad0108c4bdf8f007b89e1a52fc766aad (patch)
tree7bd62ac8d9af079c3994565f3f200ccc250bbc28 /indra/llcommon/lldate.h
parent95f365789f4cebc7bd97ccefd538f14d481a8373 (diff)
svn merge -r106715:HEAD svn+ssh://svn.lindenlab.com/svn/linden/branches/q/notifications-merge-r106715 . QAR-1149 -- Final merge of notifications to trunk.
Diffstat (limited to 'indra/llcommon/lldate.h')
-rw-r--r--indra/llcommon/lldate.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h
index 2b53c8cc9a..b660f9fcdd 100644
--- a/indra/llcommon/lldate.h
+++ b/indra/llcommon/lldate.h
@@ -35,6 +35,7 @@
#define LL_LLDATE_H
#include <iosfwd>
+#include <string>
#include "stdtypes.h"
@@ -53,7 +54,7 @@ public:
LLDate();
/**
- * @brief Construct a date equal to epoch.
+ * @brief Construct a date equal the source date.
*/
LLDate(const LLDate& date);
@@ -111,6 +112,32 @@ public:
* @param seconds The number of seconds since epoch UTC.
*/
void secondsSinceEpoch(F64 seconds);
+
+ /**
+ * @brief Create an LLDate object set to the current time.
+ *
+ * @return The number of seconds since epoch UTC.
+ */
+ static LLDate now();
+
+ /**
+ * @brief Compare dates using operator< so we can order them using STL.
+ *
+ * @param rhs -- the right hand side of the comparison operator
+ */
+ bool operator<(const LLDate& rhs) const;
+
+ /**
+ * @brief Remaining comparison operators in terms of operator<
+ * This conforms to the expectation of STL.
+ *
+ * @param rhs -- the right hand side of the comparison operator
+ */
+ bool operator>(const LLDate& rhs) const { return rhs < *this; }
+ bool operator<=(const LLDate& rhs) const { return !(rhs < *this); }
+ bool operator>=(const LLDate& rhs) const { return !(*this < rhs); }
+ bool operator!=(const LLDate& rhs) const { return (*this < rhs) || (rhs < *this); }
+ bool operator==(const LLDate& rhs) const { return !(*this != rhs); }
private:
F64 mSecondsSinceEpoch;