Replace now() which is deprecated (processone/ejabberd#1264)

This commit is contained in:
Badlop 2016-08-23 13:11:13 +02:00
parent 41371cf7fe
commit 65f4267fc1
2 changed files with 3 additions and 4 deletions

View File

@ -62,8 +62,7 @@ time_to_ms(IntervalUnit, IntervalNum) ->
end.
time_until_event(IntervalMS) ->
{MegaSecs, Secs, MicroSecs} = erlang:now(),
NowMS = (MegaSecs*1000000 + Secs)*1000 + round(MicroSecs/1000),
NowMS = p1_time_compat:system_time(micro_seconds),
MSSinceLastEvent = (NowMS rem IntervalMS),
(IntervalMS - MSSinceLastEvent).

View File

@ -260,8 +260,8 @@ get_gregorian_day() -> calendar:date_to_gregorian_days(date()).
get_now_iso(Timezone) ->
TimeStamp = case Timezone of
local -> calendar:now_to_local_time(now());
universal -> calendar:now_to_universal_time(now())
local -> calendar:local_time();
universal -> calendar:universal_time()
end,
binary_to_list(jlib:timestamp_to_legacy(TimeStamp)).