Book HomeApache: The Definitive GuideSearch this book

10.2. File Modification Time

The last modification time of a file can be reported with flastmod. This gives the client an idea of the freshness of the data you are offering. The format of the output is controlled by the timefmt attribute of the config element. The default rules for timefmt are the same as for the C library function strftime( ) , except that the year is now shown in four-digit format to cope with the Year 2000 problem.

Figure 10.2 Win 32 Apache is soon to be modified to make it work in the same way as the Unix version. Win32 users who do not have access to Unix C manuals can consult the FreeBSD documentation at http://www.freebsd.org, for example:

% man strftime

(We have not included it here because it may well vary from system to system.)

The file time.shtml gives an example:

<!--#config errmsg="Bungled again!"-->
<!--#config timefmt="%A %B %C, the %jth day of the year, %S seconds 
    since the  Epoch"-->
The mod time of this file is <!--#flastmod virtual="size.shtml"-->
The mod time of another_file is <!--#flastmod virtual="another_file"-->

This produces a response such as the following:

The mod time of this file is Tuesday August 19, the 240th day of the year,
841162166 seconds since the Epoch The mod time of another_file is Tuesday 
August 19, the 240th day of the year, 841162166 seconds since the Epoch


Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.