1 /***********************************************************************/
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../../LICENSE. */
12 /***********************************************************************/
14 /* $Id: utimes.c 6824 2005-03-24 17:20:54Z doligez $ */
18 #include "unixsupport.h"
22 #include <sys/types.h>
26 #include <sys/utime.h>
29 CAMLprim value unix_utimes(value path, value atime, value mtime)
31 struct utimbuf times, * t;
32 times.actime = Double_val(atime);
33 times.modtime = Double_val(mtime);
34 if (times.actime || times.modtime)
37 t = (struct utimbuf *) NULL;
38 if (utime(String_val(path), t) == -1) uerror("utimes", path);
46 #include <sys/types.h>
49 CAMLprim value unix_utimes(value path, value atime, value mtime)
51 struct timeval tv[2], * t;
52 double at = Double_val(atime);
53 double mt = Double_val(mtime);
55 tv[0].tv_usec = (at - tv[0].tv_sec) * 1000000;
57 tv[1].tv_usec = (mt - tv[1].tv_sec) * 1000000;
58 if (tv[0].tv_sec || tv[1].tv_sec)
61 t = (struct timeval *) NULL;
62 if (utimes(String_val(path), t) == -1) uerror("utimes", path);
68 CAMLprim value unix_utimes(value path, value atime, value mtime)
69 { invalid_argument("utimes not implemented"); }