From 65f4267fc1cfaf810aa0e2a583d541e5be7a6be3 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 23 Aug 2016 13:11:13 +0200 Subject: [PATCH] Replace now() which is deprecated (processone/ejabberd#1264) --- mod_cron/src/mod_cron.erl | 3 +-- mod_logxml/src/mod_logxml.erl | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mod_cron/src/mod_cron.erl b/mod_cron/src/mod_cron.erl index 32926ab..1d15d44 100644 --- a/mod_cron/src/mod_cron.erl +++ b/mod_cron/src/mod_cron.erl @@ -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). diff --git a/mod_logxml/src/mod_logxml.erl b/mod_logxml/src/mod_logxml.erl index 37c7d66..9ab5ece 100644 --- a/mod_logxml/src/mod_logxml.erl +++ b/mod_logxml/src/mod_logxml.erl @@ -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)).