time(?integer_hour, ?integer_min, ?integer_sec, ?integer_hun)

This built-in predicate unifies the current system time with the parameters. The current system time will not be changed, use put_time/4 to change the system time.

see also: date/3 get_cpu_time/1 put_date/3 put_time/4 time_elapsed/1

Examples
time(10, 10, S, Hun). this predicate fails if the current system time is not 10 minutes past 10 AM, else it succeeds and the variables S and Hun are unified with the seconds and hundredths of a second of the moment the predicate was executed
time(H, M, S, Hun). the current system time is determined and H is unified with the hours, M with the minutes, S with the seconds and Hun with the hundredths of a second of the system time

 

Exceptions
The argument Arg is not an integer a type_error(integer, Arg) exception is thrown
The argument Arg result exceeds the integer range an evaluation_error(int_overflow) exception is thrown
The argument Arg is a negative integer an evaluation_error(negative, Arg) exception is thrown

 

 

info@trinc-prolog.com