ADDED: file_modification_time/2, obtaining a time stamp.

This addresses a remaining aspect of #511.
This commit is contained in:
Markus Triska
2020-07-16 22:56:10 +02:00
parent 0f4667d942
commit 4f386b3e5e
3 changed files with 49 additions and 13 deletions

View File

@@ -53,10 +53,12 @@
delete_file/1,
make_directory/1,
working_directory/2,
path_canonical/2]).
path_canonical/2,
file_modification_time/2]).
:- use_module(library(error)).
:- use_module(library(lists)).
:- use_module(library(charsio)).
list_of_chars(Cs) :-
must_be(list, Cs),
@@ -119,3 +121,12 @@ path_canonical(Ps, Cs) :-
maplist(must_be(character), Ps),
can_be(list, Cs),
'$path_canonical'(Ps, Cs).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
T is the modification time of File.
T is a time stamp, suitable for use in format_time//2 in library(time).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
file_modification_time(File, T) :-
'$file_modification_time'(File, T0),
read_term_from_chars(T0, T).