]> granicus.if.org Git - apache/commitdiff
make the check for GMT offset occur each time through the loop,
authorKen Coar <coar@apache.org>
Wed, 16 Jun 2004 21:27:06 +0000 (21:27 +0000)
committerKen Coar <coar@apache.org>
Wed, 16 Jun 2004 21:27:06 +0000 (21:27 +0000)
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

CHANGES
docs/manual/programs/rotatelogs.xml
support/rotatelogs.c

diff --git a/CHANGES b/CHANGES
index 6de7f9aeaa711fa5ca46105c37780ae736dffb53..b88d0d03f54ac4c62f9c2316307837d5b097e383 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [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.
index 1a6045694128a08495752358fe46b8572aef71ce..6ade81ba586f9870ebc5fa9650fb5be2f4c36082 100644 (file)
@@ -1,7 +1,7 @@
 <?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
@@ -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>
 
index 38ccb003d5810d9d8ae928a02e99c8632cbed597..5f17dd534ac7058b1db4944090c3640d20d4f808 100644 (file)
@@ -128,12 +128,7 @@ int main (int argc, const char * const argv[])
         }
     }
     else {
-        if (use_localtime) {
-            apr_time_exp_t lt;
-            apr_time_exp_lt(&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 @@ int main (int argc, const char * const argv[])
             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(&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;