diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-09-14 14:31:25 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-09-14 14:31:25 -0700 |
commit | 562006aa5585a42418cae978516505035cd34d8d (patch) | |
tree | f42488d1b07907937f5b9e236617d9f02297d32d /indra/llcommon/lldate.cpp | |
parent | 9a8042d5a3edfd07727793a1939c3ab361ceec9a (diff) | |
parent | 7cd1020f2953b776e1878e7b4e365d4b23e6b07b (diff) |
Merge with SVN viewer-2.0.0-3 branch
Diffstat (limited to 'indra/llcommon/lldate.cpp')
-rw-r--r-- | indra/llcommon/lldate.cpp | 31 |
1 files changed, 31 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); |