Last active
April 29, 2022 08:38
-
-
Save seriyps/db52ff310021ee243d1e4b7fe48a3442 to your computer and use it in GitHub Desktop.
Revisions
-
seriyps revised this gist
Apr 29, 2020 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,7 @@ %% @doc uptime in native time units uptime() -> erlang:monotonic_time() - erlang:system_info(start_time). %% @doc uptime in specified time units uptime(Unit) -> -
seriyps created this gist
Jun 24, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ -export([uptime/0, uptime/1, uptime_string/0]). %% @doc uptime in native time units uptime() -> Now = erlang:system_time(), StartTime = erlang:time_offset() + erlang:system_info(start_time), Now - StartTime. %% @doc uptime in specified time units uptime(Unit) -> erlang:convert_time_unit(uptime(), native, Unit). %% @doc uptime as binary formatted string uptime_string() -> {D, {H, M, S}} = calendar:seconds_to_daystime(uptime(seconds)), list_to_binary( io_lib:format("~pd, ~p:~p:~p", [D, H, M, S])). uptime2() -> {StartTime, _} = erlang:statistics(wall_clock), {D, {H, M, S}} = calendar:seconds_to_daystime(StartTime div 1000), list_to_binary( io_lib:format("~pd, ~p:~p:~p", [D, H, M, S])).