added tm2time
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@602 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained 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)
|
||||
|
||||
|
@@ -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__ */
|
||||
|
@@ -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
21
lib/roken/tm2time.c
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user