new file
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1571 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
25
admin/admin_locl.h
Normal file
25
admin/admin_locl.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ADMIN_LOCL_H__
|
||||||
|
#define __ADMIN_LOCL_H__
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <krb5.h>
|
||||||
|
#include <hdb_err.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#include "hdb.h"
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __ADMIN_LOCL_H__ */
|
33
lib/asn1/timegm.c
Normal file
33
lib/asn1/timegm.c
Normal file
@@ -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;
|
||||||
|
}
|
Reference in New Issue
Block a user