diff --git a/admin/admin_locl.h b/admin/admin_locl.h new file mode 100644 index 000000000..8c1b9ff0f --- /dev/null +++ b/admin/admin_locl.h @@ -0,0 +1,25 @@ +/* + * $Id$ + */ + +#ifndef __ADMIN_LOCL_H__ +#define __ADMIN_LOCL_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hdb.h" + + +#endif /* __ADMIN_LOCL_H__ */ diff --git a/lib/asn1/timegm.c b/lib/asn1/timegm.c new file mode 100644 index 000000000..af3240ffb --- /dev/null +++ b/lib/asn1/timegm.c @@ -0,0 +1,33 @@ +#include "asn1_locl.h" + +RCSID("$Id$"); + +static int +is_leap(unsigned y) +{ + return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0); +} + +time_t +timegm (struct tm *tm) +{ + static const int ndays[2][12] ={ + {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, + {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; + time_t res = 0; + int i; + + for (i = 70; i < tm->tm_year; ++i) + res += is_leap(i) ? 366 : 365; + + for (i = 0; i < tm->tm_mon; ++i) + res += ndays[is_leap(tm->tm_year)][i]; + res += tm->tm_mday - 1; + res *= 24; + res += tm->tm_hour; + res *= 60; + res += tm->tm_min; + res *= 60; + res += tm->tm_sec; + return res; +}