|
79 | 79 | open_port/2, |
80 | 80 | system_time/1, |
81 | 81 | group_leader/0, |
| 82 | + group_leader/2, |
82 | 83 | process_flag/2, |
83 | 84 | get_module_info/1, |
84 | 85 | get_module_info/2, |
85 | 86 | processes/0, |
86 | 87 | binary_to_term/1, |
87 | | - term_to_binary/1 |
| 88 | + term_to_binary/1, |
| 89 | + timestamp/0, |
| 90 | + universaltime/0, |
| 91 | + localtime/0 |
88 | 92 | ]). |
89 | 93 |
|
90 | 94 | -export_type([ |
91 | | - time_unit/0 |
| 95 | + time_unit/0, |
| 96 | + timestamp/0 |
92 | 97 | ]). |
93 | 98 |
|
94 | 99 | %% |
|
100 | 105 |
|
101 | 106 | -type mem_type() :: binary(). |
102 | 107 | -type time_unit() :: second | millisecond | microsecond. |
| 108 | +-type timestamp() :: { |
| 109 | + MegaSecs :: non_neg_integer(), Secs :: non_neg_integer(), MicroSecs :: non_neg_integer |
| 110 | +}. |
103 | 111 |
|
104 | 112 | %%----------------------------------------------------------------------------- |
105 | 113 | %% @param Time time in milliseconds after which to send the timeout message. |
@@ -833,6 +841,17 @@ system_time(_Unit) -> |
833 | 841 | group_leader() -> |
834 | 842 | erlang:nif_error(undefined). |
835 | 843 |
|
| 844 | +%%----------------------------------------------------------------------------- |
| 845 | +%% @param Leader pid of process to set as leader |
| 846 | +%% @param Pid pid of process to set a Leader |
| 847 | +%% @returns `true' |
| 848 | +%% @doc Set the group leader for a given process. |
| 849 | +%% @end |
| 850 | +%%----------------------------------------------------------------------------- |
| 851 | +-spec group_leader(Leader :: pid(), Pid :: pid()) -> true. |
| 852 | +group_leader(_Leader, _Pid) -> |
| 853 | + erlang:nif_error(undefined). |
| 854 | + |
836 | 855 | %%----------------------------------------------------------------------------- |
837 | 856 | %% @param Flag flag to change |
838 | 857 | %% @param Value new value of the flag |
@@ -913,3 +932,36 @@ binary_to_term(_Binary) -> |
913 | 932 | -spec term_to_binary(Term :: any()) -> binary(). |
914 | 933 | term_to_binary(_Term) -> |
915 | 934 | erlang:nif_error(undefined). |
| 935 | + |
| 936 | +%%----------------------------------------------------------------------------- |
| 937 | +%% @returns A tuple representing the current timestamp. |
| 938 | +%% @see monotonic_time/1 |
| 939 | +%% @see system_time/1 |
| 940 | +%% @doc Return the timestamp in `{MegaSec, Sec, MicroSec}' format. |
| 941 | +%% This the old format returned by `erlang:now/0'. Please note that the latter |
| 942 | +%% which is deprecated in Erlang/OTP is not implemented by AtomVM. |
| 943 | +%% @end |
| 944 | +%%----------------------------------------------------------------------------- |
| 945 | +-spec timestamp() -> erlang:timestamp(). |
| 946 | +timestamp() -> |
| 947 | + erlang:nif_error(undefined). |
| 948 | + |
| 949 | +%%----------------------------------------------------------------------------- |
| 950 | +%% @returns A tuple representing the current universal time. |
| 951 | +%% @see localtime/0 |
| 952 | +%% @doc Return the current time and day for UTC. |
| 953 | +%% @end |
| 954 | +%%----------------------------------------------------------------------------- |
| 955 | +-spec universaltime() -> calendar:datetime(). |
| 956 | +universaltime() -> |
| 957 | + erlang:nif_error(undefined). |
| 958 | + |
| 959 | +%%----------------------------------------------------------------------------- |
| 960 | +%% @returns A tuple representing the current local time. |
| 961 | +%% @see universaltime/0 |
| 962 | +%% @doc Return the current time and day for system local timezone. |
| 963 | +%% @end |
| 964 | +%%----------------------------------------------------------------------------- |
| 965 | +-spec localtime() -> calendar:datetime(). |
| 966 | +localtime() -> |
| 967 | + erlang:nif_error(undefined). |
0 commit comments