let touch
?(atime=true)
?(mtime=true)
?(create=true)
?(time=Touch_now)
fln =
let set_time () =
let ftime =
match time with
| Touch_now ->
Unix.gettimeofday ()
| Touch_timestamp time_ref ->
time_ref
| Touch_file_time fln_ref ->
(Unix.stat fln_ref).Unix.st_mtime
in
let cur_stat =
Unix.stat fln
in
Unix.utimes
fln
(if atime then ftime else cur_stat.Unix.st_atime)
(if mtime then ftime else cur_stat.Unix.st_mtime)
in
if test Exists fln then
(
set_time ()
)
else if create then
(
close_out (open_out fln);
set_time ()
)
else
()