(|l)gpl-2.[01].tex: Remove the `\renewcommand{\theenumi}...' comments.
[cfd] / getdate.y
index 4be26bf..1a7c788 100644 (file)
--- a/getdate.y
+++ b/getdate.y
@@ -14,6 +14,7 @@
 
 #include <stdio.h>
 #include <ctype.h>
+#include <stdlib.h>
 
 #define ISSPACE(c) (isspace ((unsigned char)c))
 #define ISALPHA(c) (isalpha ((unsigned char)c))
@@ -370,7 +371,7 @@ relunit     : tUNUMBER tYEAR_UNIT {
        ;
 
 number : tUNUMBER
-          {
+         {
            if (yyHaveTime && yyHaveDate && !yyHaveRel)
              yyYear = $1;
            else
@@ -392,8 +393,8 @@ number      : tUNUMBER
                      }
                    else
                      {
-                       yyHour = $1 / 100;
-                       yyMinutes = $1 % 100;
+                       yyHour = $1 / 100;
+                       yyMinutes = $1 % 100;
                      }
                    yySeconds = 0;
                    yyMeridian = MER24;
@@ -836,6 +837,8 @@ yylex ()
 
 #define TM_YEAR_ORIGIN 1900
 
+#ifndef GETDATE_IGNORE_TIMEZONE
+
 /* Yield A - B, measured in seconds.  */
 static long
 difftm (a, b)
@@ -858,6 +861,8 @@ difftm (a, b)
          + (a->tm_sec - b->tm_sec));
 }
 
+#endif
+
 time_t
 get_date (p, now)
      const char *p;
@@ -919,14 +924,15 @@ get_date (p, now)
     {
 
       /* Guard against falsely reporting errors near the time_t boundaries
-         when parsing times in other time zones.  For example, if the min
-         time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
-         of UTC, then the min localtime value is 1970-01-01 08:00:00; if
-         we apply mktime to 1970-01-01 00:00:00 we will get an error, so
-         we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
-         zone by 24 hours to compensate.  This algorithm assumes that
-         there is no DST transition within a day of the time_t boundaries.  */
-
+        when parsing times in other time zones.  For example, if the min
+        time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
+        of UTC, then the min localtime value is 1970-01-01 08:00:00; if
+        we apply mktime to 1970-01-01 00:00:00 we will get an error, so
+        we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
+        zone by 24 hours to compensate.  This algorithm assumes that
+        there is no DST transition within a day of the time_t boundaries.  */
+
+#ifndef GETDATE_IGNORE_TIMEZONE
       if (yyHaveZone)
        {
          tm = tm0;
@@ -942,6 +948,7 @@ get_date (p, now)
            }
          Start = mktime (&tm);
        }
+#endif
 
       if (Start == (time_t) -1)
        return Start;
@@ -956,6 +963,7 @@ get_date (p, now)
        return Start;
     }
 
+#ifndef GETDATE_IGNORE_TIMEZONE
   if (yyHaveZone)
     {
       long delta = yyTimezone * 60L + difftm (&tm, gmtime (&Start));
@@ -963,6 +971,7 @@ get_date (p, now)
        return -1;              /* time_t overflow */
       Start += delta;
     }
+#endif
 
   return Start;
 }