diff options
author | Badlop <badlop@process-one.net> | 2010-09-13 14:05:10 +0400 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2010-09-13 14:06:13 +0400 |
commit | 8a0ccfc40124b7860df40428cdc4f9854dacebcd (patch) | |
tree | e1ad50e43f2ffb6d5eb394a7339a7f7febdedbe2 /src | |
parent | c29b2fda991a4d090b0a729a41b6fb0e0022e050 (diff) |
Support timezone West of UTC (thanks to Edwin Fine)(EJAB-1301)
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_time.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mod_time.erl b/src/mod_time.erl index a8a43c0ab..e96c0ea72 100644 --- a/src/mod_time.erl +++ b/src/mod_time.erl @@ -76,7 +76,13 @@ process_local_iq(_From, _To, #iq{type = Type, sub_el = SubEl} = IQ) -> {UTC, UTC_diff} = jlib:timestamp_to_iso(Now_universal, utc), Seconds_diff = calendar:datetime_to_gregorian_seconds(Now_local) - calendar:datetime_to_gregorian_seconds(Now_universal), - {Hd, Md, _} = calendar:seconds_to_time(Seconds_diff), + {Hd, Md, _} = case Seconds_diff >= 0 of + true -> + calendar:seconds_to_time(Seconds_diff); + false -> + {Hd0, Md0, Sd0} = calendar:seconds_to_time(-Seconds_diff), + {-Hd0, Md0, Sd0} + end, {_, TZO_diff} = jlib:timestamp_to_iso({{0, 0, 0}, {0, 0, 0}}, {Hd, Md}), IQ#iq{type = result, sub_el = [{xmlelement, "time", |