added tm2time

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@602 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-06-27 03:56:14 +00:00
parent 23889c1c74
commit 867e9bc946
4 changed files with 30 additions and 1 deletions

View File

@@ -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)

View File

@@ -71,4 +71,8 @@ char *getstr(char *id, char **cpp);
#include <pwd.h>
struct passwd *k_getpwnam (char *user);
#include <time.h>
#include <sys/time.h>
time_t tm2time (struct tm tm, int local);
#endif /* __ROKEN_H__ */

View File

@@ -71,4 +71,8 @@ char *getstr(char *id, char **cpp);
#include <pwd.h>
struct passwd *k_getpwnam (char *user);
#include <time.h>
#include <sys/time.h>
time_t tm2time (struct tm tm, int local);
#endif /* __ROKEN_H__ */

21
lib/roken/tm2time.c Normal file
View File

@@ -0,0 +1,21 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
RCSID("$Id$");
#endif
#include <time.h>
#include <sys/time.h>
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;
}