I would like to do the program in Prolog that allows its user to execute any procedure he wants to in that way:
1. The program reads from the keyboard the procedure that the user wants to execute (it's simple).
2. After that the Prolog sholud run that procedure. For example: user writes...
% Getting current time
% H - hour
% M - minutes
% S - seconds
current_time(H,M,S) :-
get_time(TS),
stamp_date_time(TS,Date9,'local'),
arg(4,Date9,H),
arg(5,Date9,M),
arg(6,Date6,S.
That's solved my problem! I use 'local' as the third parameter of the stamp_date_time and everything works as I wish to. Thank you for help.
current_time(H,M) :-
get_time(TS),
stamp_date_time(TS,Date9,'local'),
arg(4,Date9,H),
arg(5,Date9,M).
Thank you, kahleen, for the answer. I've already found the solution, the same as yours, but I've another problem. I live in Poland and my applications works using my local time (UTC+2) so I set the timezone to value -7200. The problem is that we have, in Polad, the summer (UTC+2) and the winter...
Hello to everybody.
I wonder how to get the current time from Prolog. I know how to get current date, but can't do that with the time. I want to get 3 variables (Hour, Minutes, Secs).
Thanks for help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.