diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-06-15 12:53:56 -0400 |
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-06-15 12:53:56 -0400 |
| commit | 44f65edd68699ecf3f692351b3a601b71585bf6e (patch) | |
| tree | 04cb09c82cb94d323192993bc53e31412de980e7 /indra/llcommon/lldate.cpp | |
| parent | 961656863a5e50e5f80e1e316811b884dd8a949f (diff) | |
| parent | da078d9a35e256a59652f6ed545b3cb09f384bb0 (diff) | |
merge
Diffstat (limited to 'indra/llcommon/lldate.cpp')
| -rw-r--r-- | indra/llcommon/lldate.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index de7f2ead74..a7ef28b431 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -248,8 +248,27 @@ bool LLDate::fromStream(std::istream& s) s >> fractional; seconds_since_epoch += fractional; } - c = s.get(); // skip the Z - if (c != 'Z') { return false; } + + c = s.peek(); // check for offset + if (c == '+' || c == '-') + { + S32 offset_sign = (c == '+') ? 1 : -1; + S32 offset_hours = 0; + S32 offset_minutes = 0; + S32 offset_in_seconds = 0; + + s >> offset_hours; + + c = s.get(); // skip the colon a get the minutes if there are any + if (c == ':') + { + s >> offset_minutes; + } + + offset_in_seconds = (offset_hours * 60 + offset_sign * offset_minutes) * 60; + seconds_since_epoch -= offset_in_seconds; + } + else if (c != 'Z') { return false; } // skip the Z mSecondsSinceEpoch = seconds_since_epoch; return true; |
