[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl-dev
Subject:    Re: [mp2] apr/finfo test 10 fails on Windows
From:       Geoffrey Young <geoff () modperlcookbook ! org>
Date:       2003-12-16 13:50:27
[Download RAW message or body]


> 
> # testing : $r->finfo->atime()
> # expected: 1071570596
> # received: 1071571230

> where the 1071570596 time is the time at which I unpacked and built the 
> mod_perl 2 cvs snapshot, and the (offending) 1071571230 time is the time 
> at which I am running the test.
> 
> The "expected" time (1071570596) is that produced by Perl's built-in 
> stat(), while the "received" time (1071571230) is that produced by 
> Apache's $r->finfo()->stat().  It is definitely Apache that is wrong 
> here, because Windows explorer agrees with Perl that the last access 
> time is 1071570596 -- the time at which mod_perl 2 was built.

I might have an answer here.  APR is using the windows API for atime,
specifically &wininfo->ftLastAccessTime, where wininfo is populated by
GetFileInformationByHandle.  in the GetFileInformationByHandle docs it says
this:

ftLastAccessTime
    A FILETIME structure. For a file, the structure specifies when the file
was last read from or written to. For a directory, the structure specifies
when the directory was created. For both files and directories, the
specified date will be correct, but the time of day will always be set to
midnight. If the underlying file system does not support last access time,
this member is zero.

so, Apache uses this API.  does 1071570596 refer to midnight on your system?
  probably not :)  nevertheless, perl seems to be using a simple fstat call,
and not GetFileInformationByHandle.  hence the descrepancy I'd think.

from all this I gather that at least one thing is clear: $finfo->atime() is
documented to be inconsistent with perl's stat() atime on Win32, even if it
sometimes works.

so, I'd suggest skipping that test on Win32.  at least this time we have a
(half) decent explanation :)

--Geoff

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/by_handle_file_information_str.asp



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic