Guys... the API is wrong, as we've been scolded about several times.
In APR 1.0, we've discussed eliminating ctime (ambigious) for some
other more specific datum (e.g. itime for the inode-info time modification
on unix, and crtime for the file creation time on Win32.)

The general suggestion is goodness, but the patch below would 
continue to promote ctime ambiguity.

Bill

At 10:28 PM 7/2/2003, Cliff Woolley wrote:
>On Wed, 2 Jul 2003, Ben Collins-Sussman wrote:
>
>> Subversion is already using apr_stat() to read the mtime of a file.
>> But now we'd like to be able to *write* timestamps as well.
>> Has this conversation been had before?
>
>I did some digging on marc.theaimsgroup and found this:
>
>http://marc.theaimsgroup.com/?l=apr-dev&m=104970018703214&w=2
>
>It looks like a patch was submitted to do exactly that by Matt Kraai,
>though it only provided an implementation for unix, and it seems to have
>fallen through the cracks anyway.  Justin reviewed the original patch,
>though the revised one seems to have gotten no response.  It was:
>
>Index: file_io/unix/filestat.c
>===================================================================
>RCS file: /home/cvspublic/apr/file_io/unix/filestat.c,v
>retrieving revision 1.65
>diff -u -r1.65 filestat.c
>--- file_io/unix/filestat.c     6 Mar 2003 09:21:24 -0000       1.65
>+++ file_io/unix/filestat.c     4 Apr 2003 03:58:25 -0000
>@@ -208,6 +208,30 @@
>     return apr_file_perms_set(fname, finfo.protection);
> }
>
>+APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
>+                                             apr_time_t mtime,
>+                                             apr_pool_t *pool)
>+{
>+    apr_status_t status;
>+    apr_finfo_t finfo;
>+    struct timeval tvp[2];
>+
>+    status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool);
>+    if (!APR_STATUS_IS_SUCCESS(status)) {
>+        return status;
>+    }
>+
>+    tvp[0].tv_sec = apr_time_sec(finfo.atime);
>+    tvp[0].tv_usec = apr_time_usec(finfo.atime);
>+    tvp[1].tv_sec = apr_time_sec(mtime);
>+    tvp[1].tv_usec = apr_time_usec(mtime);
>+
>+    if (utimes(fname, tvp) == -1) {
>+        return errno;
>+    }
>+    return APR_SUCCESS;
>+}
>+
> APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo,
>                                    const char *fname,
>                                    apr_int32_t wanted, apr_pool_t *pool)
>Index: include/apr_file_io.h
>===================================================================
>RCS file: /home/cvspublic/apr/include/apr_file_io.h,v
>retrieving revision 1.138
>diff -u -r1.138 apr_file_io.h
>--- include/apr_file_io.h       3 Apr 2003 23:20:05 -0000       1.138
>+++ include/apr_file_io.h       4 Apr 2003 03:58:27 -0000
>@@ -658,6 +658,18 @@
>                                              apr_pool_t *cont);
>
> /**
>+ * Set the mtime of the specified file.
>+ * @param fname The full path to the file (using / on all systems)
>+ * @param mtime The mtime to apply to the file.
>+ * @param pool The pool to use.
>+ * @warning Platforms which do not implement this feature will return
>+ *      APR_ENOTIMPL.
>+ */
>+APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
>+                                             apr_time_t mtime,
>+                                             apr_pool_t *pool);
>+
>+/**
>  * Create a new directory on the file system.
>  * @param path the path for the directory to be created.  (use / on all 
> systems)
>  * @param perm Permissions for the new direcoty.


Reply via email to