diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-09-11 23:56:28 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-09-11 23:56:28 +0000 |
commit | 245172949fa6b4ee4fde7da66f7abb804503ed9a (patch) | |
tree | b626db2b79442ca815949c7b40c51192954b1f30 /indra/llcommon | |
parent | 7df79382a075646a51f21bed0d7f8de883fc3608 (diff) |
merge -r 1649-1651 https://svn.aws.productengine.com/secondlife/pe/stable-2@1648 -> viewer-2.0.0-3
Fixes: EXT-843 EXT-846
New Dev: EXT-514
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lldate.cpp | 31 | ||||
-rw-r--r-- | indra/llcommon/lldate.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 41150ad057..7c0ac6c554 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -155,6 +155,37 @@ void LLDate::toStream(std::ostream& s) const s << 'Z'; } +bool LLDate::split(S32 *year, S32 *month, S32 *day, S32 *hour, S32 *min, S32 *sec) const +{ + apr_time_t time = (apr_time_t)(mSecondsSinceEpoch * LL_APR_USEC_PER_SEC); + + apr_time_exp_t exp_time; + if (apr_time_exp_gmt(&exp_time, time) != APR_SUCCESS) + { + return false; + } + + if (year) + *year = exp_time.tm_year + 1900; + + if (month) + *month = exp_time.tm_mon + 1; + + if (day) + *day = exp_time.tm_mday; + + if (hour) + *hour = exp_time.tm_hour; + + if (min) + *min = exp_time.tm_min; + + if (sec) + *sec = exp_time.tm_sec; + + return true; +} + bool LLDate::fromString(const std::string& iso8601_date) { std::istringstream stream(iso8601_date); diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 9dcce9117f..38c4c8cb60 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -84,6 +84,7 @@ public: std::string asString() const; std::string asRFC1123() const; void toStream(std::ostream&) const; + bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; std::string toHTTPDateString (std::string fmt) const; static std::string toHTTPDateString (tm * gmt, std::string fmt); /** |