in case a switch between standard and daylight savings time
occurred. (correction to previous code courtesy of Uli Zappe.)
PR: 24417
Submitted by: Uli Zappe <uli ritual.org>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103973
13f79535-47bb-0310-9956-
ffa450edef68
[Remove entries to the current 2.0 section below, when backported]
+ *) Add -l option to rotatelogs to let it use local time rather than
+ UTC. PR 24417. [Ken Coar, Uli Zappe <uli ritual.org>]
+
*) Drop the ErrorHeader directive which turned out to be a misnomer.
Instead there's a new optional flag for the Header directive
('always'), which keeps the former ErrorHeader functionality.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
-<!-- $Revision: 1.9 $ -->
+<!-- $Revision: 1.10 $ -->
<!--
Copyright 2003-2004 The Apache Software Foundation
<p><code><strong>rotatelogs</strong>
[ -<strong>l</strong> ]
- <var>logfile</var>
+ <var>logfile</var>
[ <var>rotationtime</var> [ <var>offset</var> ]] |
[ <var>filesize</var>M ]</code></p>
</section>
<dl>
<dt><code>-l</code></dt>
-<dd>causes the use of local time rather than GMT as the base for the
+<dd>Causes the use of local time rather than GMT as the base for the
interval. Note that using <code>-l</code> in an environment which changes the
GMT offset (such as for BST or DST) can lead to unpredictable results!</dd>
}
}
else {
- if (use_localtime) {
- apr_time_exp_t lt;
- apr_time_exp_lt(<, apr_time_now());
- utc_offset = lt.tm_gmtoff;
- }
- else if (argc >= (argBase + 4)) {
+ if (argc >= (argBase + 4)) {
utc_offset = atoi(argv[argOffset]) * 60;
}
tRotation = atoi(argv[argIntv]);
exit(3);
}
if (tRotation) {
+ /*
+ * Check for our UTC offset every time through the loop, since
+ * it might change if there's a switch between standard and
+ * daylight savings time.
+ */
+ if (use_localtime) {
+ apr_time_exp_t lt;
+ apr_time_exp_lt(<, apr_time_now());
+ utc_offset = lt.tm_gmtoff;
+ }
now = (int)(apr_time_now() / APR_USEC_PER_SEC) + utc_offset;
if (nLogFD != NULL && now >= tLogEnd) {
nLogFDprev = nLogFD;