erlang:system_info( start_time ) as date_time?

Rickard Green rickard@REDACTED
Tue Apr 7 00:02:23 CEST 2020


On Mon, Apr 6, 2020 at 10:34 PM bengt <cean.ebengt@REDACTED> wrote:

> Greetings,
>
> How do I get from
> 1> erlang:system_info(start_time).
> -576460752000000000
>
> to some thing like {{2020,4,6},{22,27,0}} ?
>
>
>
For example:
  calendar:system_time_to_local_time(erlang:system_info(start_time) +
erlang:time_offset(), native).

There is also some other system_time_to_* functions in calendar. Note that
if you are using single or multi time warp mode <
https://erlang.org/doc/apps/erts/time_correction.html#Time_Warp_Modes> the
time offset may have changed since you started the VM. That is, depending
on use case you may want to save the time offset when starting the system.


> Different question:
> Is it possible to find out when a gen_server was started? Or how long it
> has been running? Without letting init/1 save it in state.
> It would help me finding out if a gen_server was started by its supervisor
> about the time when the data transfer suddenly dipped.
>
>
>
No, you need to save this time yourself if needed.


> Best Wishes,
> bengt
>

Regards,
Rickard
-- 
Rickard Green, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200407/0f9f1071/attachment.htm>


More information about the erlang-questions mailing list