aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/lldate.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llcommon/lldate.h
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llcommon/lldate.h')
-rw-r--r--linden/indra/llcommon/lldate.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/linden/indra/llcommon/lldate.h b/linden/indra/llcommon/lldate.h
index 7adf724..32825b1 100644
--- a/linden/indra/llcommon/lldate.h
+++ b/linden/indra/llcommon/lldate.h
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -35,6 +36,7 @@
35#define LL_LLDATE_H 36#define LL_LLDATE_H
36 37
37#include <iosfwd> 38#include <iosfwd>
39#include <string>
38 40
39#include "stdtypes.h" 41#include "stdtypes.h"
40 42
@@ -53,7 +55,7 @@ public:
53 LLDate(); 55 LLDate();
54 56
55 /** 57 /**
56 * @brief Construct a date equal to epoch. 58 * @brief Construct a date equal to the source date.
57 */ 59 */
58 LLDate(const LLDate& date); 60 LLDate(const LLDate& date);
59 61
@@ -111,12 +113,37 @@ public:
111 * @param seconds The number of seconds since epoch UTC. 113 * @param seconds The number of seconds since epoch UTC.
112 */ 114 */
113 void secondsSinceEpoch(F64 seconds); 115 void secondsSinceEpoch(F64 seconds);
116
117 /**
118 * @brief Create an LLDate object set to the current time.
119 *
120 * @return The number of seconds since epoch UTC.
121 */
122 static LLDate now();
123
124 /**
125 * @brief Compare dates using operator< so we can order them using STL.
126 *
127 * @param rhs -- the right hand side of the comparison operator
128 */
129 bool operator<(const LLDate& rhs) const;
130
131 /**
132 * @brief Remaining comparison operators in terms of operator<
133 * This conforms to the expectation of STL.
134 *
135 * @param rhs -- the right hand side of the comparison operator
136 */
137 bool operator>(const LLDate& rhs) const { return rhs < *this; }
138 bool operator<=(const LLDate& rhs) const { return !(rhs < *this); }
139 bool operator>=(const LLDate& rhs) const { return !(*this < rhs); }
140 bool operator!=(const LLDate& rhs) const { return (*this < rhs) || (rhs < *this); }
141 bool operator==(const LLDate& rhs) const { return !(*this != rhs); }
114 142
115private: 143private:
116 F64 mSecondsSinceEpoch; 144 F64 mSecondsSinceEpoch;
117}; 145};
118 146
119
120// Helper function to stream out a date 147// Helper function to stream out a date
121std::ostream& operator<<(std::ostream& s, const LLDate& date); 148std::ostream& operator<<(std::ostream& s, const LLDate& date);
122 149