summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'time.c')
-rw-r--r--time.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/time.c b/time.c
index d72d3a42b9..a81c3bb789 100644
--- a/time.c
+++ b/time.c
@@ -440,6 +440,15 @@ search_time_t(tptr, utc_p)
(1UL << (8 * sizeof(time_t) - 1)) - 1 :
~(time_t)0;
+#if defined(HAVE_MKTIME)
+ if ((guess = mktime(tptr)) != -1) {
+ if (guess_lo < guess - 24 * 60 * 60)
+ guess_lo = guess - 24 * 60 * 60;
+ if (guess + 24 * 60 * 60 < guess_hi)
+ guess_hi = guess + 24 * 60 * 60;
+ }
+#endif
+
tm = (utc_p ? gmtime : localtime)(&guess_lo);
if (!tm) goto error;
d = tmcmp(tptr, tm);