diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1998-06-09 15:06:39 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1998-06-09 15:06:39 +0000 |
commit | 5c8f53d793d7a9a9cc0e5e7efc9a386e343ca76b (patch) | |
tree | 1f8956bdb171e318135c26904b0f7a63e5401cac /otherlibs/unix/stat.c | |
parent | 4542b86635e065b813b0b5b19bf9bc5bf0b00b25 (diff) |
Probleme de l'an 2004: utilisation du type float a la place du type int pour representer les dates Unix
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1981 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix/stat.c')
-rw-r--r-- | otherlibs/unix/stat.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/otherlibs/unix/stat.c b/otherlibs/unix/stat.c index da5da047e..628bd4c1a 100644 --- a/otherlibs/unix/stat.c +++ b/otherlibs/unix/stat.c @@ -12,6 +12,7 @@ /* $Id$ */ #include <mlvalues.h> +#include <memory.h> #include <alloc.h> #include "unixsupport.h" #include "cst2constr.h" @@ -38,21 +39,27 @@ static int file_kind_table[] = { static value stat_aux(struct stat *buf) { value v; + value atime = Val_unit, mtime = Val_unit, ctime = Val_unit; - v = alloc_tuple(12); - Field (v, 0) = Val_int (buf->st_dev); - Field (v, 1) = Val_int (buf->st_ino); - Field (v, 2) = cst_to_constr(buf->st_mode & S_IFMT, file_kind_table, - sizeof(file_kind_table) / sizeof(int), 0); - Field (v, 3) = Val_int(buf->st_mode & 07777); - Field (v, 4) = Val_int (buf->st_nlink); - Field (v, 5) = Val_int (buf->st_uid); - Field (v, 6) = Val_int (buf->st_gid); - Field (v, 7) = Val_int (buf->st_rdev); - Field (v, 8) = Val_int (buf->st_size); - Field (v, 9) = Val_int (buf->st_atime); - Field (v, 10) = Val_int (buf->st_mtime); - Field (v, 11) = Val_int (buf->st_ctime); + Begin_roots3(atime,mtime,ctime) + atime = copy_double((double) buf->st_atime); + mtime = copy_double((double) buf->st_mtime); + ctime = copy_double((double) buf->st_ctime); + v = alloc_tuple(12); + Field (v, 0) = Val_int (buf->st_dev); + Field (v, 1) = Val_int (buf->st_ino); + Field (v, 2) = cst_to_constr(buf->st_mode & S_IFMT, file_kind_table, + sizeof(file_kind_table) / sizeof(int), 0); + Field (v, 3) = Val_int(buf->st_mode & 07777); + Field (v, 4) = Val_int (buf->st_nlink); + Field (v, 5) = Val_int (buf->st_uid); + Field (v, 6) = Val_int (buf->st_gid); + Field (v, 7) = Val_int (buf->st_rdev); + Field (v, 8) = Val_int (buf->st_size); + Field (v, 9) = atime; + Field (v, 10) = ctime; + Field (v, 11) = mtime; + End_roots(); return v; } |