summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorLibravatar Carlo Marcelo Arenas Belón <carenas@gmail.com>2020-05-14 12:18:54 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-05-14 13:52:27 -0700
commit84b0115f0dc9483dbc7f064b46afaddc4d94db92 (patch)
tree7eb5a416646e93d86e5923a39036405c4941a70b /compat
parentGit 2.25.4 (diff)
downloadtgif-84b0115f0dc9483dbc7f064b46afaddc4d94db92.tar.xz
compat: remove gmtime
ccd469450a (date.c: switch to reentrant {gm,local}time_r, 2019-11-28) removes the only gmtime() call we had and moves to gmtime_r() which doesn't have the same portability problems. Remove the compat gmtime code since it is no longer needed, and confirm by successfull running t4212 in FreeBSD 9.3 amd64 (the oldest I could get a hold off). Further work might be needed to ensure 32bit time_t systems (like FreeBSD i386) will handle correctly the overflows tested in t4212, but that is orthogonal to this change, and it doesn't change the current behaviour as neither gmtime() or gmtime_r() will ever return NULL on those systems because time_t is unsigned. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/gmtime.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/compat/gmtime.c b/compat/gmtime.c
deleted file mode 100644
index e8362dd2b9..0000000000
--- a/compat/gmtime.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "../git-compat-util.h"
-#undef gmtime
-#undef gmtime_r
-
-struct tm *git_gmtime(const time_t *timep)
-{
- static struct tm result;
- return git_gmtime_r(timep, &result);
-}
-
-struct tm *git_gmtime_r(const time_t *timep, struct tm *result)
-{
- struct tm *ret;
-
- memset(result, 0, sizeof(*result));
- ret = gmtime_r(timep, result);
-
- /*
- * Rather than NULL, FreeBSD gmtime simply leaves the "struct tm"
- * untouched when it encounters overflow. Since "mday" cannot otherwise
- * be zero, we can test this very quickly.
- */
- if (ret && !ret->tm_mday) {
- ret = NULL;
- errno = EOVERFLOW;
- }
-
- return ret;
-}