154154 code_change /3 , handle_cast /2 , terminate /2 ]).
155155
156156% % Types which can be used by other modules
157- -export_type ([tref / 0 ]).
157+ -export_type ([tref / 0 , time / 0 ]).
158158
159159% % Max value for a receive's after clause.
160160-define (MAX_RECEIVE_AFTER , 16#ffffffff ).
@@ -171,8 +171,10 @@ done
171171-doc " A timer reference." .
172172-opaque tref () :: {type (), reference ()}.
173173-type type () :: 'once' | 'interval' | 'instant' | 'send_local' .
174+
174175-doc " Time in milliseconds." .
175- -type time () :: non_neg_integer ().
176+ -doc #{since => ~ " OTP @OTP-19526@" }.
177+ -nominal time () :: non_neg_integer ().
176178
177179% %
178180% % Interface functions
@@ -678,21 +680,21 @@ now_diff({A2, B2, C2}, {A1, B1, C1}) ->
678680-doc " Returns the number of milliseconds in `Seconds`." .
679681-spec seconds (Seconds ) -> MilliSeconds
680682 when Seconds :: non_neg_integer (),
681- MilliSeconds :: non_neg_integer ().
683+ MilliSeconds :: time ().
682684seconds (Seconds ) ->
683685 1000 * Seconds .
684686
685687-doc " Returns the number of milliseconds in `Minutes`." .
686688-spec minutes (Minutes ) -> MilliSeconds
687689 when Minutes :: non_neg_integer (),
688- MilliSeconds :: non_neg_integer ().
690+ MilliSeconds :: time ().
689691minutes (Minutes ) ->
690692 1000 * 60 * Minutes .
691693
692694-doc " Returns the number of milliseconds in `Hours`." .
693695-spec hours (Hours ) -> MilliSeconds
694696 when Hours :: non_neg_integer (),
695- MilliSeconds :: non_neg_integer ().
697+ MilliSeconds :: time ().
696698hours (Hours ) ->
697699 1000 * 60 * 60 * Hours .
698700
@@ -701,7 +703,7 @@ hours(Hours) ->
701703 when Hours :: non_neg_integer (),
702704 Minutes :: non_neg_integer (),
703705 Seconds :: non_neg_integer (),
704- MilliSeconds :: non_neg_integer ().
706+ MilliSeconds :: time ().
705707hms (H , M , S ) ->
706708 hours (H ) + minutes (M ) + seconds (S ).
707709
0 commit comments