* Return the latest rational time from a request/mtime (modification time) * pair. We return the mtime unless it's in the future, in which case we * return the current time. We use the request time as a reference in order * to limit the number of calls to time(). We don't check for futurosity * unless the mtime is at least as new as the reference. */
| 172 | * unless the mtime is at least as new as the reference. |
| 173 | */ |
| 174 | AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime) |
| 175 | { |
| 176 | apr_time_t now; |
| 177 | |
| 178 | /* For all static responses, it's almost certain that the file was |
| 179 | * last modified before the beginning of the request. So there's |
| 180 | * no reason to call time(NULL) again. But if the response has been |
| 181 | * created on demand, then it might be newer than the time the request |
| 182 | * started. In this event we really have to call time(NULL) again |
| 183 | * so that we can give the clients the most accurate Last-Modified. If we |
| 184 | * were given a time in the future, we return the current time - the |
| 185 | * Last-Modified can't be in the future. |
| 186 | */ |
| 187 | now = (mtime < r->request_time) ? r->request_time : apr_time_now(); |
| 188 | return (mtime > now) ? now : mtime; |
| 189 | } |
| 190 | |
| 191 | /* Get a line of protocol input, including any continuation lines |
| 192 | * caused by MIME folding (or broken clients) if fold != 0, and place it |
no outgoing calls
no test coverage detected