httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Lewis <...@joe-lewis.com>
Subject Re: Converting apr_finfo_t.mtime into a Unix timestamp
Date Mon, 24 Mar 2008 00:24:30 GMT
Sam Carleton wrote:
> My PHP code needs to set the if_modified_since header, but to set it,
> it needs to consider two times, one of it's data source, but also of a
> configuration file that is only known to the Apache C Module.  Already
> I am passing a number of variables to the PHP code via the
> r->subprocess_env, and I would now like to also pass the
> apr_finfo_t.mtime of the config file, but in a format that PHP can
> understand.  In the PHP code, I am going to be using filemtime() which
> returns a Unix timestamp.
>
> How can I convert apr_finfo_t.mtime into a Unix timestamp?
>
> Sam
>   
I ran into this just this afternoon, and I am still looking for an 
answer, but what I have found may be helpful.

What I found is that there is an apr_time_ansi_put converts a time_t to 
an apr_time_t, but the only thing that may convert the apr_time_t into 
the number of seconds since Jan 1st 1970 is apr_time_sec(apr_time_t) .

With you looking to set a header (a text string), you may want to 
consider using apr_rfc822_date() to take the apr_finfo_t.mtime and turn 
it directly into a string and then just set the header to that value.

Joe

Mime
View raw message