You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2005/07/16 10:07:53 UTC

svn commit: r219295 - in /apr/apr/trunk: file_io/os2/filestat.c include/arch/os2/apr_arch_file_io.h time/unix/time.c

Author: bjh
Date: Sat Jul 16 01:07:53 2005
New Revision: 219295

URL: http://svn.apache.org/viewcvs?rev=219295&view=rev
Log:
OS/2: Implement apr_file_mtime_set().

Modified:
    apr/apr/trunk/file_io/os2/filestat.c
    apr/apr/trunk/include/arch/os2/apr_arch_file_io.h
    apr/apr/trunk/time/unix/time.c

Modified: apr/apr/trunk/file_io/os2/filestat.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/os2/filestat.c?rev=219295&r1=219294&r2=219295&view=diff
==============================================================================
--- apr/apr/trunk/file_io/os2/filestat.c (original)
+++ apr/apr/trunk/file_io/os2/filestat.c Sat Jul 16 01:07:53 2005
@@ -225,5 +225,16 @@
                                               apr_time_t mtime,
                                               apr_pool_t *pool)
 {
-  return APR_ENOTIMPL;
+    FILESTATUS3 fs3;
+    ULONG rc;
+    rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3));
+
+    if (rc) {
+        return APR_FROM_OS_ERROR(rc);
+    }
+
+    apr_apr_time_to_os2_time(&fs3.fdateLastWrite, &fs3.ftimeLastWrite, mtime);
+
+    rc = DosSetPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3), 0);
+    return APR_FROM_OS_ERROR(rc);
 }

Modified: apr/apr/trunk/include/arch/os2/apr_arch_file_io.h
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/arch/os2/apr_arch_file_io.h?rev=219295&r1=219294&r2=219295&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/os2/apr_arch_file_io.h (original)
+++ apr/apr/trunk/include/arch/os2/apr_arch_file_io.h Sat Jul 16 01:07:53 2005
@@ -66,6 +66,8 @@
 apr_status_t apr_file_cleanup(void *);
 apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, 
                                       FTIME os2time);
+apr_status_t apr_apr_time_to_os2_time(FDATE *os2date, FTIME *os2time,
+                                      apr_time_t aprtime);
 
 /* see win32/fileio.h for description of these */
 extern const char c_is_fnchar[256];

Modified: apr/apr/trunk/time/unix/time.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/time/unix/time.c?rev=219295&r1=219294&r2=219295&view=diff
==============================================================================
--- apr/apr/trunk/time/unix/time.c (original)
+++ apr/apr/trunk/time/unix/time.c Sat Jul 16 01:07:53 2005
@@ -267,6 +267,23 @@
   *result = mktime(&tmpdate) * APR_USEC_PER_SEC;
   return APR_SUCCESS;
 }
+
+APR_DECLARE(apr_status_t) apr_apr_time_to_os2_time(FDATE *os2date,
+                                                   FTIME *os2time,
+                                                   apr_time_t aprtime)
+{
+    time_t ansitime = aprtime / APR_USEC_PER_SEC;
+    struct tm *lt;
+    lt = localtime(&ansitime);
+    os2time->hours    = lt->tm_hour;
+    os2time->minutes  = lt->tm_min;
+    os2time->twosecs  = lt->tm_sec / 2;
+
+    os2date->day      = lt->tm_mday;
+    os2date->month    = lt->tm_mon + 1;
+    os2date->year     = lt->tm_year - 80;
+    return APR_SUCCESS;
+}
 #endif
 
 #ifdef NETWARE



Re: svn commit: r219295 - in /apr/apr/trunk: file_io/os2/filestat.c include/arch/os2/apr_arch_file_io.h time/unix/time.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
> apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, 
>                                       FTIME os2time);
>+apr_status_t apr_apr_time_to_os2_time(FDATE *os2date, FTIME *os2time,
>+                                      apr_time_t aprtime);

I'm looking at this - doesn't it seem more like an apr_os_
function, if you are going to export these two?

Bill  


Re: svn commit: r219295 - in /apr/apr/trunk: file_io/os2/filestat.c include/arch/os2/apr_arch_file_io.h time/unix/time.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
> apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, 
>                                       FTIME os2time);
>+apr_status_t apr_apr_time_to_os2_time(FDATE *os2date, FTIME *os2time,
>+                                      apr_time_t aprtime);

I'm looking at this - doesn't it seem more like an apr_os_
function, if you are going to export these two?

Bill