dhcpd-pools  2.28
ISC dhcpd lease usage analyser
Macros | Typedefs | Functions | Variables
mktime.c File Reference
#include <config.h>
#include <time.h>
#include <limits.h>
#include <string.h>
#include "mktime-internal.h"
Include dependency graph for mktime.c:

Macros

#define LEAP_SECONDS_POSSIBLE   1
 
#define WRAPV   0
 
#define verify(name, assertion)   struct name { char a[(assertion) ? 1 : -1]; }
 
#define SHR(a, b)
 
#define TYPE_IS_INTEGER(t)   ((t) 1.5 == 1)
 
#define TYPE_TWOS_COMPLEMENT(t)   ((t) ~ (t) 0 == (t) -1)
 
#define TYPE_SIGNED(t)   (! ((t) 0 < (t) -1))
 
#define TYPE_MINIMUM(t)
 
#define TYPE_MAXIMUM(t)
 
#define TIME_T_MIN   TYPE_MINIMUM (time_t)
 
#define TIME_T_MAX   TYPE_MAXIMUM (time_t)
 
#define TIME_T_MIDPOINT   (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)
 
#define EPOCH_YEAR   1970
 
#define TM_YEAR_BASE   1900
 
#define __localtime_r   localtime_r
 
#define __mktime_internal   mktime_internal
 

Typedefs

typedef long int long_int
 

Functions

 verify (long_int_is_wide_enough, INT_MAX==INT_MAX *(long_int) 2/2)
 
 verify (time_t_is_integer, TYPE_IS_INTEGER(time_t))
 
 verify (twos_complement_arithmetic,(TYPE_TWOS_COMPLEMENT(int)&&TYPE_TWOS_COMPLEMENT(long_int)&&TYPE_TWOS_COMPLEMENT(time_t)))
 
 verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE%100==0)
 
static int leapyear (long_int year)
 
static int isdst_differ (int a, int b)
 
static time_t ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1, int year0, int yday0, int hour0, int min0, int sec0)
 
static time_t time_t_avg (time_t a, time_t b)
 
static int time_t_add_ok (time_t a, time_t b)
 
static int time_t_int_add_ok (time_t a, int b)
 
static time_t guess_time_tm (long_int year, long_int yday, int hour, int min, int sec, const time_t *t, const struct tm *tp)
 
static struct tm * ranged_convert (struct tm *(*convert)(const time_t *, struct tm *), time_t *t, struct tm *tp)
 
time_t __mktime_internal (struct tm *tp, struct tm *(*convert)(const time_t *, struct tm *), time_t *offset)
 
time_t mktime (struct tm *tp)
 

Variables

static const unsigned short int __mon_yday [2][13]
 
static time_t localtime_offset
 

Macro Definition Documentation

#define __localtime_r   localtime_r

Referenced by mktime().

#define __mktime_internal   mktime_internal

Referenced by mktime().

#define EPOCH_YEAR   1970

Referenced by __mktime_internal().

#define LEAP_SECONDS_POSSIBLE   1

Referenced by __mktime_internal().

#define SHR (   a,
 
)
Value:
((-1 >> 1 == -1 \
&& (long_int) -1 >> 1 == -1 \
&& ((time_t) -1 >> 1 == -1 || ! TYPE_SIGNED (time_t))) \
? (a) >> (b) \
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
#define TYPE_SIGNED(t)
Definition: mktime.c:111
long int long_int
Definition: mktime.c:76

Referenced by __mktime_internal(), time_t_avg(), time_t_int_add_ok(), and ydhms_diff().

#define TIME_T_MAX   TYPE_MAXIMUM (time_t)
#define TIME_T_MIDPOINT   (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)

Referenced by guess_time_tm(), and time_t_add_ok().

#define TIME_T_MIN   TYPE_MINIMUM (time_t)
#define TM_YEAR_BASE   1900
#define TYPE_IS_INTEGER (   t)    ((t) 1.5 == 1)
#define TYPE_MAXIMUM (   t)
Value:
((t) (! TYPE_SIGNED (t) \
? (t) -1 \
: ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
#define TYPE_SIGNED(t)
Definition: mktime.c:111
#define TYPE_MINIMUM (   t)
Value:
((t) (! TYPE_SIGNED (t) \
? (t) 0 \
: ~ TYPE_MAXIMUM (t)))
#define TYPE_SIGNED(t)
Definition: mktime.c:111
#define TYPE_MAXIMUM(t)
Definition: mktime.c:121
#define TYPE_SIGNED (   t)    (! ((t) 0 < (t) -1))

Referenced by time_t_add_ok().

#define TYPE_TWOS_COMPLEMENT (   t)    ((t) ~ (t) 0 == (t) -1)
#define verify (   name,
  assertion 
)    struct name { char a[(assertion) ? 1 : -1]; }
#define WRAPV   0

Referenced by time_t_add_ok(), and time_t_int_add_ok().

Typedef Documentation

typedef long int long_int

Function Documentation

time_t __mktime_internal ( struct tm *  tp,
struct tm *(*)(const time_t *, struct tm *)  convert,
time_t *  offset 
)

Here is the call graph for this function:

static time_t guess_time_tm ( long_int  year,
long_int  yday,
int  hour,
int  min,
int  sec,
const time_t *  t,
const struct tm *  tp 
)
static

Referenced by __mktime_internal().

Here is the call graph for this function:

static int isdst_differ ( int  a,
int  b 
)
static

Referenced by __mktime_internal().

static int leapyear ( long_int  year)
static

Referenced by __mktime_internal().

time_t mktime ( struct tm *  tp)

Referenced by mktime_z().

static struct tm* ranged_convert ( struct tm *(*)(const time_t *, struct tm *)  convert,
time_t *  t,
struct tm *  tp 
)
static

Referenced by __mktime_internal().

Here is the call graph for this function:

static int time_t_add_ok ( time_t  a,
time_t  b 
)
static

Referenced by guess_time_tm().

Here is the call graph for this function:

static time_t time_t_avg ( time_t  a,
time_t  b 
)
static

Referenced by ranged_convert(), and time_t_add_ok().

static int time_t_int_add_ok ( time_t  a,
int  b 
)
static

Referenced by __mktime_internal().

verify ( long_int_is_wide_enough  ,
INT_MAX  = =INT_MAX *(long_int) 2/2 
)
verify ( time_t_is_integer  ,
TYPE_IS_INTEGER(time_t)   
)
verify ( twos_complement_arithmetic  ,
(TYPE_TWOS_COMPLEMENT(int)&&TYPE_TWOS_COMPLEMENT(long_int)&&TYPE_TWOS_COMPLEMENT(time_t))   
)
verify ( base_year_is_a_multiple_of_100  ,
TM_YEAR_BASE 100 = =0 
)
static time_t ydhms_diff ( long_int  year1,
long_int  yday1,
int  hour1,
int  min1,
int  sec1,
int  year0,
int  yday0,
int  hour0,
int  min0,
int  sec0 
)
static

Referenced by __mktime_internal(), and guess_time_tm().

Variable Documentation

const unsigned short int __mon_yday[2][13]
static
Initial value:
=
{
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
}
time_t localtime_offset
static