X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/blobdiff_plain/2d13b3c847173bdc62adc0c9e354eedbe76c3461..6247b831dd0e3f9200025241ac93c14e5c1b2539:/getdate.y diff --git a/getdate.y b/getdate.y index 4be26bf..a9de991 100644 --- a/getdate.y +++ b/getdate.y @@ -14,6 +14,7 @@ #include #include +#include #define ISSPACE(c) (isspace ((unsigned char)c)) #define ISALPHA(c) (isalpha ((unsigned char)c)) @@ -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; @@ -927,6 +932,7 @@ get_date (p, now) 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; }