diff options
author | Darren Tucker <dtucker@dtucker.net> | 2019-10-29 19:45:03 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2019-10-29 20:48:46 +1100 |
commit | 1bcd1169c5221688418fa38606e9c69055b72451 (patch) | |
tree | 61a589dff15dc626b876bb51f532320c7ee79a9e /openbsd-compat | |
parent | 2046ed16c1202431b0307674c33a123a113e8297 (diff) |
Add implementation of localtime_r.
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/bsd-misc.c | 10 | ||||
-rw-r--r-- | openbsd-compat/bsd-misc.h | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 7a26ee40..829e0c07 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -426,3 +426,13 @@ int _ssh_compat_fflush(FILE *f) return fflush(f); } #endif + +#ifndef HAVE_LOCALTIME_R +struct tm * +localtime_r(const time_t *timep, struct tm *result) +{ + struct tm *tm = localtime(timep); + *result = *tm; + return result; +} +#endif diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index f5b032bb..5a369d9d 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h @@ -178,4 +178,8 @@ int flock(int, int); # define fflush(x) (_ssh_compat_fflush(x)) #endif +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *, struct tm *); +#endif + #endif /* _BSD_MISC_H */ |