coar 2004/06/16 14:27:06
Modified: . CHANGES
support rotatelogs.c
docs/manual/programs rotatelogs.xml
Log:
make the check for GMT offset occur each time through the loop,
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>
Revision Changes Path
1.1517 +3 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.1516
retrieving revision 1.1517
diff -u -u -r1.1516 -r1.1517
--- CHANGES 14 Jun 2004 22:11:25 -0000 1.1516
+++ CHANGES 16 Jun 2004 21:27:06 -0000 1.1517
@@ -2,6 +2,9 @@
[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.
1.35 +11 -6 httpd-2.0/support/rotatelogs.c
Index: rotatelogs.c
===================================================================
RCS file: /home/cvs/httpd-2.0/support/rotatelogs.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -u -r1.34 -r1.35
--- rotatelogs.c 14 Jun 2004 17:02:54 -0000 1.34
+++ rotatelogs.c 16 Jun 2004 21:27:06 -0000 1.35
@@ -128,12 +128,7 @@
}
}
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]);
@@ -155,6 +150,16 @@
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;
1.10 +3 -3 httpd-2.0/docs/manual/programs/rotatelogs.xml
Index: rotatelogs.xml
===================================================================
RCS file: /home/cvs/httpd-2.0/docs/manual/programs/rotatelogs.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- rotatelogs.xml 11 Jun 2004 22:18:25 -0000 1.9
+++ rotatelogs.xml 16 Jun 2004 21:27:06 -0000 1.10
@@ -59,7 +59,7 @@
<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>
@@ -69,7 +69,7 @@
<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>
|