From 867e9bc9463fa778279d32bd3f44134f260c8956 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Thu, 27 Jun 1996 03:56:14 +0000 Subject: [PATCH] added tm2time git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@602 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/Makefile.in | 2 +- lib/roken/roken.h | 4 ++++ lib/roken/roken.h.in | 4 ++++ lib/roken/tm2time.c | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 lib/roken/tm2time.c diff --git a/lib/roken/Makefile.in b/lib/roken/Makefile.in index fb34714ef..d54e795c2 100644 --- a/lib/roken/Makefile.in +++ b/lib/roken/Makefile.in @@ -31,7 +31,7 @@ SHLIBEXT = @SHLIBEXT@ LIB = $(LIBNAME).$(LIBEXT) -OBJECTS = k_getpwnam.o signal.o verify.o @LIBOBJS@ +OBJECTS = k_getpwnam.o signal.o tm2time.o verify.o @LIBOBJS@ all: $(LIB) diff --git a/lib/roken/roken.h b/lib/roken/roken.h index 22b81de7a..0d69ce329 100644 --- a/lib/roken/roken.h +++ b/lib/roken/roken.h @@ -71,4 +71,8 @@ char *getstr(char *id, char **cpp); #include struct passwd *k_getpwnam (char *user); +#include +#include +time_t tm2time (struct tm tm, int local); + #endif /* __ROKEN_H__ */ diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 22b81de7a..0d69ce329 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -71,4 +71,8 @@ char *getstr(char *id, char **cpp); #include struct passwd *k_getpwnam (char *user); +#include +#include +time_t tm2time (struct tm tm, int local); + #endif /* __ROKEN_H__ */ diff --git a/lib/roken/tm2time.c b/lib/roken/tm2time.c new file mode 100644 index 000000000..031eda8ab --- /dev/null +++ b/lib/roken/tm2time.c @@ -0,0 +1,21 @@ +#ifdef HAVE_CONFIG_H +#include +RCSID("$Id$"); +#endif + +#include +#include + +time_t +tm2time (struct tm tm, int local) +{ + time_t t; + + tm.tm_isdst = -1; + + t = mktime (&tm); + + if (!local) + t += t - mktime (gmtime (&t)); + return t; +}