summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-10-29 19:45:03 +1100
committerDarren Tucker <dtucker@dtucker.net>2019-10-29 20:48:46 +1100
commit1bcd1169c5221688418fa38606e9c69055b72451 (patch)
tree61a589dff15dc626b876bb51f532320c7ee79a9e
parent2046ed16c1202431b0307674c33a123a113e8297 (diff)
Add implementation of localtime_r.
-rw-r--r--configure.ac1
-rw-r--r--openbsd-compat/bsd-misc.c10
-rw-r--r--openbsd-compat/bsd-misc.h4
3 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ea99887fd..9b4a7ee62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1763,6 +1763,7 @@ AC_CHECK_FUNCS([ \
1763 inet_ntop \ 1763 inet_ntop \
1764 innetgr \ 1764 innetgr \
1765 llabs \ 1765 llabs \
1766 localtime_r \
1766 login_getcapbool \ 1767 login_getcapbool \
1767 md5_crypt \ 1768 md5_crypt \
1768 memmem \ 1769 memmem \
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 7a26ee40c..829e0c075 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -426,3 +426,13 @@ int _ssh_compat_fflush(FILE *f)
426 return fflush(f); 426 return fflush(f);
427} 427}
428#endif 428#endif
429
430#ifndef HAVE_LOCALTIME_R
431struct tm *
432localtime_r(const time_t *timep, struct tm *result)
433{
434 struct tm *tm = localtime(timep);
435 *result = *tm;
436 return result;
437}
438#endif
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index f5b032bbc..5a369d9de 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -178,4 +178,8 @@ int flock(int, int);
178# define fflush(x) (_ssh_compat_fflush(x)) 178# define fflush(x) (_ssh_compat_fflush(x))
179#endif 179#endif
180 180
181#ifndef HAVE_LOCALTIME_R
182struct tm *localtime_r(const time_t *, struct tm *);
183#endif
184
181#endif /* _BSD_MISC_H */ 185#endif /* _BSD_MISC_H */