erlang中使用日期和时间的赋值不明确

erlang中使用日期和时间的赋值不明确,erlang,Erlang,我正在学习Joe Armstrong编写的《Erlang编程:并发世界的软件》一书,我正在试图弄清楚在后续章节的末尾,作为一项作业,我需要解决什么问题。以下是作业: 查找erlang:now/0 erlang:date/0和erlang:time/0的定义。编写一个名为my_time_funcF的函数,该函数计算fun F以及所需时间 我不明白作业要求我做什么。你能给我一些不同参数输出的例子或者其他解释吗?它想让你写一个函数,计算运行另一个函数所需的时间 my_time_fun:my_time_

我正在学习Joe Armstrong编写的《Erlang编程:并发世界的软件》一书,我正在试图弄清楚在后续章节的末尾,作为一项作业,我需要解决什么问题。以下是作业:

查找erlang:now/0 erlang:date/0和erlang:time/0的定义。编写一个名为my_time_funcF的函数,该函数计算fun F以及所需时间


我不明白作业要求我做什么。你能给我一些不同参数输出的例子或者其他解释吗?

它想让你写一个函数,计算运行另一个函数所需的时间

my_time_fun:my_time_fun(fun() -> io:format("hi!~n") end).
hi!
This function took 0 megaseconds, 0 seconds, and 54 microseconds to complete
ok

它希望您编写一个函数,计算运行另一个函数所需的时间

my_time_fun:my_time_fun(fun() -> io:format("hi!~n") end).
hi!
This function took 0 megaseconds, 0 seconds, and 54 microseconds to complete
ok

您还可以查看内置功能计时器的说明:tc/1,也可以查看内置功能计时器的说明:tc/1