[ejabberd] mod_time

jacob jabber ejabberd.jacob at gmail.com
Sat Sep 24 12:50:03 MSK 2016


thanks badlop. when changed mod_time module and send

<iq type='get' to='localhost'>
  <query xmlns='urn:xmpp:time'/>
</iq>

using psi, gajim and smack, ejabberd returns this error:

[error] <0.1943.0>@gen_iq_handler:process_iq:129
{undef,[{erlang,system_time,[milli_seconds],[]},{mod_time,process_local_iq,3,[{file,"src/mod_time.erl"},{line,63}]},{gen_iq_handler,process_iq,6,[{file,"src/gen_iq_handler.erl"},{line,128}]},{gen_iq_handler,handle_info,2,[{file,"src/gen_iq_handler.erl"},{line,172}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,593}]},{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,659}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}

how to fix it?
line 63 is Ms =
iolist_to_binary(string:right(integer_to_list(erlang:system_time(milli_seconds)
 os:system_time
rem 1000), 3, $0))

thanks fro your kind response.


On Thu, Sep 22, 2016 at 12:30 PM, <ejabberd-request at jabber.ru> wrote:

> Send ejabberd mailing list submissions to
>         ejabberd at jabber.ru
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.jabber.ru/mailman/listinfo/ejabberd
> or, via email, send a message with subject or body 'help' to
>         ejabberd-request at jabber.ru
>
> You can reach the person managing the list at
>         ejabberd-owner at jabber.ru
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ejabberd digest..."
>
>
> Today's Topics:
>
>    1. Re: mod_time (Badlop)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 21 Sep 2016 13:11:36 +0200
> From: Badlop <badlop at gmail.com>
> To: ejabberd at jabber.ru
> Subject: Re: [ejabberd] mod_time
> Message-ID:
>         <CAA6KaLzWzfBye-cydrHybxGA4Ahfp36wnrZ2GBi-
> 3DTKpRfM2Q at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> If you mean to provide result with resolution up to milliseconds, here
> is a quick and dirty patch:
>
> --- a/src/mod_time.erl
> +++ b/src/mod_time.erl
> @@ -61,6 +61,7 @@ process_local_iq(_From, _To,
>          Now_local = calendar:universal_time_to_local_time(Now_universal),
>          {UTC, UTC_diff} = jlib:timestamp_to_iso(Now_universal,
>                                                  utc),
> +         Ms = iolist_to_binary(string:right(
> integer_to_list(erlang:system_time(milli_seconds)
> rem 1000), 3, $0)),
>          Seconds_diff =
>              calendar:datetime_to_gregorian_seconds(Now_local) -
>                calendar:datetime_to_gregorian_seconds(Now_universal),
> @@ -79,7 +80,7 @@ process_local_iq(_From, _To,
>                                 #xmlel{name = <<"utc">>, attrs = [],
>                                        children =
>                                            [{xmlcdata,
> -                                              <<UTC/binary,
> +                                              <<UTC/binary, ".",
> Ms/binary,
>                                                 UTC_diff/binary>>}]}]}]}
>     end.
>
>
> The result is:
> <iq type='get' to='localhost'>
>   <query xmlns='urn:xmpp:time'/>
> </iq>
>
> <iq from='localhost' to='user1 at localhost/tka1' type='result'>
>   <time xmlns='urn:xmpp:time'>
>     <tzo>+02:00</tzo>
>     <utc>2016-09-21T11:07:12.664Z</utc>
>   </time>
> </iq>
>
>
> ---
> Badlop
> ProcessOne
>
> On 14 September 2016 at 09:40, jacob jabber <ejabberd.jacob at gmail.com>
> wrote:
> > hi
> > mod_time returns time to seconds, how to change it for returns that to
> > millisecond?
> > thanks alot.
> >
> > --
> >
> > Best Regards
> >
> > _______________________________________________
> > ejabberd mailing list
> > ejabberd at jabber.ru
> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
>
> ------------------------------
>
> End of ejabberd Digest, Vol 158, Issue 5
> ****************************************
>



-- 

*Best Regards*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20160924/283a91c4/attachment.html>


More information about the ejabberd mailing list