calendar:seconds_to_time/1
把秒数转为时间
用法:
seconds_to_time(Seconds) -> time()
内部实现:
-type secs_per_day() :: 0..?SECONDS_PER_DAY. -spec seconds_to_time(Seconds) -> time() when Seconds :: secs_per_day(). seconds_to_time(Secs) when Secs >= 0, Secs Secs0 = Secs rem ?SECONDS_PER_DAY, Hour = Secs0 div ?SECONDS_PER_HOUR, Secs1 = Secs0 rem ?SECONDS_PER_HOUR, Minute = Secs1 div ?SECONDS_PER_MINUTE, Second = Secs1 rem ?SECONDS_PER_MINUTE, {Hour, Minute, Second}.
这个函数把给出的秒数 Seconds 转为时间。
calendar:seconds_to_time(12345).
参数 Seconds 必须小于一天的秒数(86400)。
calendar:seconds_to_time(123456).