Home | History | Annotate | Line # | Download | only in time
private.h revision 1.26.2.2
      1  1.26.2.2       tls /*	$NetBSD: private.h,v 1.26.2.2 2014/08/20 00:02:16 tls Exp $	*/
      2       1.2       jtc 
      3       1.1       jtc #ifndef PRIVATE_H
      4       1.1       jtc #define PRIVATE_H
      5       1.3       jtc 
      6       1.3       jtc /* NetBSD defaults */
      7       1.3       jtc #define TM_GMTOFF	tm_gmtoff
      8       1.3       jtc #define TM_ZONE		tm_zone
      9       1.3       jtc #define STD_INSPIRED	1
     10       1.3       jtc #define HAVE_LONG_DOUBLE 1
     11      1.21     bjh21 
     12      1.21     bjh21 /* For when we build zic as a host tool. */
     13      1.23     lukem #if HAVE_NBTOOL_CONFIG_H
     14      1.23     lukem #include "nbtool_config.h"
     15      1.21     bjh21 #endif
     16       1.1       jtc 
     17       1.1       jtc /*
     18       1.6       jtc ** This file is in the public domain, so clarified as of
     19      1.25   mlelstv ** 1996-06-05 by Arthur David Olson.
     20       1.6       jtc */
     21       1.6       jtc 
     22       1.6       jtc /*
     23       1.1       jtc ** This header is for use ONLY with the time conversion code.
     24       1.1       jtc ** There is no guarantee that it will remain unchanged,
     25       1.1       jtc ** or that it will remain at all.
     26       1.1       jtc ** Do NOT copy it to any system include directory.
     27       1.1       jtc ** Thank you!
     28       1.1       jtc */
     29       1.1       jtc 
     30      1.25   mlelstv #define GRANDPARENTED	"Local time zone must be set--see zic manual page"
     31      1.25   mlelstv 
     32       1.1       jtc /*
     33       1.1       jtc ** Defaults for preprocessor symbols.
     34       1.1       jtc ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
     35       1.1       jtc */
     36       1.1       jtc 
     37       1.1       jtc #ifndef HAVE_ADJTIME
     38       1.1       jtc #define HAVE_ADJTIME		1
     39       1.1       jtc #endif /* !defined HAVE_ADJTIME */
     40       1.1       jtc 
     41       1.6       jtc #ifndef HAVE_GETTEXT
     42       1.6       jtc #define HAVE_GETTEXT		0
     43       1.6       jtc #endif /* !defined HAVE_GETTEXT */
     44       1.6       jtc 
     45      1.17    kleink #ifndef HAVE_INCOMPATIBLE_CTIME_R
     46      1.17    kleink #define HAVE_INCOMPATIBLE_CTIME_R	0
     47      1.17    kleink #endif /* !defined INCOMPATIBLE_CTIME_R */
     48      1.17    kleink 
     49  1.26.2.2       tls #ifndef HAVE_LINK
     50  1.26.2.2       tls #define HAVE_LINK		1
     51  1.26.2.2       tls #endif /* !defined HAVE_LINK */
     52  1.26.2.2       tls 
     53       1.1       jtc #ifndef HAVE_SETTIMEOFDAY
     54       1.1       jtc #define HAVE_SETTIMEOFDAY	3
     55       1.1       jtc #endif /* !defined HAVE_SETTIMEOFDAY */
     56       1.1       jtc 
     57      1.12    kleink #ifndef HAVE_SYMLINK
     58      1.12    kleink #define HAVE_SYMLINK		1
     59      1.12    kleink #endif /* !defined HAVE_SYMLINK */
     60       1.6       jtc 
     61      1.20    kleink #ifndef HAVE_SYS_STAT_H
     62      1.20    kleink #define HAVE_SYS_STAT_H		1
     63      1.20    kleink #endif /* !defined HAVE_SYS_STAT_H */
     64      1.20    kleink 
     65      1.14    kleink #ifndef HAVE_SYS_WAIT_H
     66      1.14    kleink #define HAVE_SYS_WAIT_H		1
     67      1.14    kleink #endif /* !defined HAVE_SYS_WAIT_H */
     68      1.14    kleink 
     69       1.1       jtc #ifndef HAVE_UNISTD_H
     70       1.1       jtc #define HAVE_UNISTD_H		1
     71       1.1       jtc #endif /* !defined HAVE_UNISTD_H */
     72       1.1       jtc 
     73       1.5       jtc #ifndef HAVE_UTMPX_H
     74       1.5       jtc #define HAVE_UTMPX_H		0
     75       1.5       jtc #endif /* !defined HAVE_UTMPX_H */
     76       1.5       jtc 
     77      1.18    kleink #ifdef LOCALE_HOME
     78      1.19       cgd #undef LOCALE_HOME		/* not to be handled by tzcode itself */
     79      1.18    kleink #endif /* defined LOCALE_HOME */
     80       1.1       jtc 
     81      1.17    kleink #if HAVE_INCOMPATIBLE_CTIME_R
     82      1.17    kleink #define asctime_r _incompatible_asctime_r
     83      1.17    kleink #define ctime_r _incompatible_ctime_r
     84      1.17    kleink #endif /* HAVE_INCOMPATIBLE_CTIME_R */
     85      1.17    kleink 
     86       1.1       jtc /*
     87       1.1       jtc ** Nested includes
     88       1.1       jtc */
     89       1.1       jtc 
     90       1.1       jtc #include "sys/types.h"	/* for time_t */
     91       1.1       jtc #include "stdio.h"
     92       1.1       jtc #include "errno.h"
     93       1.1       jtc #include "string.h"
     94      1.25   mlelstv #include "limits.h"	/* for CHAR_BIT et al. */
     95       1.1       jtc #include "time.h"
     96       1.1       jtc #include "stdlib.h"
     97       1.1       jtc 
     98      1.25   mlelstv #if HAVE_GETTEXT
     99       1.6       jtc #include "libintl.h"
    100      1.25   mlelstv #endif /* HAVE_GETTEXT */
    101      1.14    kleink 
    102      1.25   mlelstv #if HAVE_SYS_WAIT_H
    103      1.14    kleink #include <sys/wait.h>	/* for WIFEXITED and WEXITSTATUS */
    104      1.25   mlelstv #endif /* HAVE_SYS_WAIT_H */
    105      1.14    kleink 
    106      1.14    kleink #ifndef WIFEXITED
    107      1.14    kleink #define WIFEXITED(status)	(((status) & 0xff) == 0)
    108      1.14    kleink #endif /* !defined WIFEXITED */
    109      1.14    kleink #ifndef WEXITSTATUS
    110      1.14    kleink #define WEXITSTATUS(status)	(((status) >> 8) & 0xff)
    111      1.14    kleink #endif /* !defined WEXITSTATUS */
    112       1.6       jtc 
    113      1.25   mlelstv #if HAVE_UNISTD_H
    114      1.25   mlelstv #include "unistd.h"	/* for F_OK, R_OK, and other POSIX goodness */
    115      1.25   mlelstv #endif /* HAVE_UNISTD_H */
    116       1.1       jtc 
    117       1.1       jtc #ifndef F_OK
    118       1.1       jtc #define F_OK	0
    119       1.1       jtc #endif /* !defined F_OK */
    120       1.1       jtc #ifndef R_OK
    121       1.1       jtc #define R_OK	4
    122       1.1       jtc #endif /* !defined R_OK */
    123       1.1       jtc 
    124      1.25   mlelstv /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
    125       1.4       jtc #define is_digit(c) ((unsigned)(c) - '0' <= 9)
    126       1.4       jtc 
    127       1.1       jtc /*
    128      1.25   mlelstv ** Define HAVE_STDINT_H's default value here, rather than at the
    129      1.25   mlelstv ** start, since __GLIBC__'s value depends on previously-included
    130      1.25   mlelstv ** files.
    131      1.25   mlelstv ** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.)
    132      1.25   mlelstv */
    133      1.25   mlelstv #ifndef HAVE_STDINT_H
    134      1.25   mlelstv #define HAVE_STDINT_H \
    135  1.26.2.2       tls    (199901 <= __STDC_VERSION__ \
    136  1.26.2.2       tls     || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__)	\
    137  1.26.2.2       tls     || __CYGWIN__)
    138      1.25   mlelstv #endif /* !defined HAVE_STDINT_H */
    139      1.25   mlelstv 
    140      1.25   mlelstv #if HAVE_STDINT_H
    141      1.25   mlelstv #include "stdint.h"
    142      1.25   mlelstv #endif /* !HAVE_STDINT_H */
    143      1.25   mlelstv 
    144  1.26.2.2       tls #ifndef HAVE_INTTYPES_H
    145  1.26.2.2       tls # define HAVE_INTTYPES_H HAVE_STDINT_H
    146  1.26.2.2       tls #endif
    147  1.26.2.2       tls #if HAVE_INTTYPES_H
    148  1.26.2.2       tls # include <inttypes.h>
    149  1.26.2.2       tls #endif
    150  1.26.2.2       tls 
    151      1.25   mlelstv #ifndef INT_FAST64_MAX
    152      1.25   mlelstv /* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX.  */
    153      1.25   mlelstv #if defined LLONG_MAX || defined __LONG_LONG_MAX__
    154      1.25   mlelstv typedef long long	int_fast64_t;
    155  1.26.2.2       tls # ifdef LLONG_MAX
    156  1.26.2.2       tls #  define INT_FAST64_MIN LLONG_MIN
    157  1.26.2.2       tls #  define INT_FAST64_MAX LLONG_MAX
    158  1.26.2.2       tls # else
    159  1.26.2.2       tls #  define INT_FAST64_MIN __LONG_LONG_MIN__
    160  1.26.2.2       tls #  define INT_FAST64_MAX __LONG_LONG_MAX__
    161  1.26.2.2       tls # endif
    162  1.26.2.2       tls # define SCNdFAST64 "lld"
    163      1.25   mlelstv #else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
    164      1.25   mlelstv #if (LONG_MAX >> 31) < 0xffffffff
    165      1.25   mlelstv Please use a compiler that supports a 64-bit integer type (or wider);
    166      1.25   mlelstv you may need to compile with "-DHAVE_STDINT_H".
    167      1.25   mlelstv #endif /* (LONG_MAX >> 31) < 0xffffffff */
    168      1.25   mlelstv typedef long		int_fast64_t;
    169  1.26.2.2       tls # define INT_FAST64_MIN LONG_MIN
    170  1.26.2.2       tls # define INT_FAST64_MAX LONG_MAX
    171  1.26.2.2       tls # define SCNdFAST64 "ld"
    172      1.25   mlelstv #endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
    173      1.25   mlelstv #endif /* !defined INT_FAST64_MAX */
    174      1.25   mlelstv 
    175  1.26.2.2       tls #ifndef INT_FAST32_MAX
    176  1.26.2.2       tls # if INT_MAX >> 31 == 0
    177  1.26.2.2       tls typedef long int_fast32_t;
    178  1.26.2.2       tls # else
    179  1.26.2.2       tls typedef int int_fast32_t;
    180  1.26.2.2       tls # endif
    181  1.26.2.2       tls #endif
    182  1.26.2.2       tls 
    183  1.26.2.2       tls #ifndef INTMAX_MAX
    184  1.26.2.2       tls # if defined LLONG_MAX || defined __LONG_LONG_MAX__
    185  1.26.2.2       tls typedef long long intmax_t;
    186  1.26.2.2       tls #  define strtoimax strtoll
    187  1.26.2.2       tls #  define PRIdMAX "lld"
    188  1.26.2.2       tls #  ifdef LLONG_MAX
    189  1.26.2.2       tls #   define INTMAX_MAX LLONG_MAX
    190  1.26.2.2       tls #   define INTMAX_MIN LLONG_MIN
    191  1.26.2.2       tls #  else
    192  1.26.2.2       tls #   define INTMAX_MAX __LONG_LONG_MAX__
    193  1.26.2.2       tls #   define INTMAX_MIN __LONG_LONG_MIN__
    194  1.26.2.2       tls #  endif
    195  1.26.2.2       tls # else
    196  1.26.2.2       tls typedef long intmax_t;
    197  1.26.2.2       tls #  define strtoimax strtol
    198  1.26.2.2       tls #  define PRIdMAX "ld"
    199  1.26.2.2       tls #  define INTMAX_MAX LONG_MAX
    200  1.26.2.2       tls #  define INTMAX_MIN LONG_MIN
    201  1.26.2.2       tls # endif
    202  1.26.2.2       tls #endif
    203  1.26.2.2       tls 
    204  1.26.2.2       tls #ifndef UINTMAX_MAX
    205  1.26.2.2       tls # if defined ULLONG_MAX || defined __LONG_LONG_MAX__
    206  1.26.2.2       tls typedef unsigned long long uintmax_t;
    207  1.26.2.2       tls #  define PRIuMAX "llu"
    208  1.26.2.2       tls # else
    209  1.26.2.2       tls typedef unsigned long uintmax_t;
    210  1.26.2.2       tls #  define PRIuMAX "lu"
    211  1.26.2.2       tls # endif
    212  1.26.2.2       tls #endif
    213  1.26.2.2       tls 
    214      1.25   mlelstv #ifndef INT32_MAX
    215      1.25   mlelstv #define INT32_MAX 0x7fffffff
    216      1.25   mlelstv #endif /* !defined INT32_MAX */
    217      1.25   mlelstv #ifndef INT32_MIN
    218      1.25   mlelstv #define INT32_MIN (-1 - INT32_MAX)
    219      1.25   mlelstv #endif /* !defined INT32_MIN */
    220       1.1       jtc 
    221  1.26.2.2       tls #ifndef SIZE_MAX
    222  1.26.2.2       tls #define SIZE_MAX ((size_t) -1)
    223  1.26.2.2       tls #endif
    224  1.26.2.2       tls 
    225  1.26.2.2       tls #if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
    226  1.26.2.2       tls # define ATTRIBUTE_CONST __attribute__ ((__const__))
    227  1.26.2.2       tls # define ATTRIBUTE_PURE __attribute__ ((__pure__))
    228  1.26.2.2       tls # define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
    229  1.26.2.1       tls #else
    230  1.26.2.2       tls # define ATTRIBUTE_CONST /* empty */
    231  1.26.2.2       tls # define ATTRIBUTE_PURE /* empty */
    232  1.26.2.2       tls # define ATTRIBUTE_FORMAT(spec) /* empty */
    233  1.26.2.1       tls #endif
    234  1.26.2.2       tls 
    235  1.26.2.2       tls #if !defined _Noreturn && __STDC_VERSION__ < 201112
    236  1.26.2.2       tls # if 2 < __GNUC__ + (8 <= __GNUC_MINOR__)
    237  1.26.2.2       tls #  define _Noreturn __attribute__ ((__noreturn__))
    238  1.26.2.2       tls # else
    239  1.26.2.2       tls #  define _Noreturn
    240  1.26.2.2       tls # endif
    241  1.26.2.2       tls #endif
    242  1.26.2.2       tls 
    243  1.26.2.2       tls #if __STDC_VERSION__ < 199901 && !defined restrict
    244  1.26.2.2       tls # define restrict /* empty */
    245  1.26.2.1       tls #endif
    246  1.26.2.1       tls 
    247       1.1       jtc /*
    248      1.25   mlelstv ** Workarounds for compilers/systems.
    249       1.1       jtc */
    250       1.1       jtc 
    251       1.1       jtc /*
    252      1.25   mlelstv ** Some time.h implementations don't declare asctime_r.
    253      1.25   mlelstv ** Others might define it as a macro.
    254      1.25   mlelstv ** Fix the former without affecting the latter.
    255       1.1       jtc */
    256       1.1       jtc 
    257      1.25   mlelstv #ifndef asctime_r
    258      1.25   mlelstv extern char *	asctime_r(struct tm const *, char *);
    259      1.16  christos #endif
    260       1.1       jtc 
    261       1.1       jtc /*
    262  1.26.2.2       tls ** Compile with -Dtime_tz=T to build the tz package with a private
    263  1.26.2.2       tls ** time_t type equivalent to T rather than the system-supplied time_t.
    264  1.26.2.2       tls ** This debugging feature can test unusual design decisions
    265  1.26.2.2       tls ** (e.g., time_t wider than 'long', or unsigned time_t) even on
    266  1.26.2.2       tls ** typical platforms.
    267  1.26.2.2       tls */
    268  1.26.2.2       tls #ifdef time_tz
    269  1.26.2.2       tls static time_t sys_time(time_t *x) { return time(x); }
    270  1.26.2.2       tls 
    271  1.26.2.2       tls # undef  ctime
    272  1.26.2.2       tls # define ctime tz_ctime
    273  1.26.2.2       tls # undef  ctime_r
    274  1.26.2.2       tls # define ctime_r tz_ctime_r
    275  1.26.2.2       tls # undef  difftime
    276  1.26.2.2       tls # define difftime tz_difftime
    277  1.26.2.2       tls # undef  gmtime
    278  1.26.2.2       tls # define gmtime tz_gmtime
    279  1.26.2.2       tls # undef  gmtime_r
    280  1.26.2.2       tls # define gmtime_r tz_gmtime_r
    281  1.26.2.2       tls # undef  localtime
    282  1.26.2.2       tls # define localtime tz_localtime
    283  1.26.2.2       tls # undef  localtime_r
    284  1.26.2.2       tls # define localtime_r tz_localtime_r
    285  1.26.2.2       tls # undef  mktime
    286  1.26.2.2       tls # define mktime tz_mktime
    287  1.26.2.2       tls # undef  time
    288  1.26.2.2       tls # define time tz_time
    289  1.26.2.2       tls # undef  time_t
    290  1.26.2.2       tls # define time_t tz_time_t
    291  1.26.2.2       tls 
    292  1.26.2.2       tls typedef time_tz time_t;
    293  1.26.2.2       tls 
    294  1.26.2.2       tls char *ctime(time_t const *);
    295  1.26.2.2       tls char *ctime_r(time_t const *, char *);
    296  1.26.2.2       tls double difftime(time_t, time_t);
    297  1.26.2.2       tls struct tm *gmtime(time_t const *);
    298  1.26.2.2       tls struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
    299  1.26.2.2       tls struct tm *localtime(time_t const *);
    300  1.26.2.2       tls struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
    301  1.26.2.2       tls time_t mktime(struct tm *);
    302  1.26.2.2       tls 
    303  1.26.2.2       tls static time_t
    304  1.26.2.2       tls time(time_t *p)
    305  1.26.2.2       tls {
    306  1.26.2.2       tls 	time_t r = sys_time(0);
    307  1.26.2.2       tls 	if (p)
    308  1.26.2.2       tls 		*p = r;
    309  1.26.2.2       tls 	return r;
    310  1.26.2.2       tls }
    311  1.26.2.2       tls #endif
    312  1.26.2.2       tls 
    313  1.26.2.2       tls /*
    314       1.8       jtc ** Private function declarations.
    315       1.8       jtc */
    316       1.8       jtc 
    317      1.25   mlelstv char *		icatalloc(char * old, const char * new);
    318      1.25   mlelstv char *		icpyalloc(const char * string);
    319      1.25   mlelstv const char *	scheck(const char * string, const char * format);
    320       1.6       jtc 
    321       1.6       jtc /*
    322       1.1       jtc ** Finally, some convenience items.
    323       1.1       jtc */
    324       1.1       jtc 
    325       1.1       jtc #ifndef TRUE
    326       1.1       jtc #define TRUE	1
    327       1.1       jtc #endif /* !defined TRUE */
    328       1.1       jtc 
    329       1.1       jtc #ifndef FALSE
    330       1.1       jtc #define FALSE	0
    331       1.1       jtc #endif /* !defined FALSE */
    332       1.1       jtc 
    333       1.5       jtc #ifndef TYPE_BIT
    334       1.5       jtc #define TYPE_BIT(type)	(sizeof (type) * CHAR_BIT)
    335       1.5       jtc #endif /* !defined TYPE_BIT */
    336       1.5       jtc 
    337       1.5       jtc #ifndef TYPE_SIGNED
    338  1.26.2.1       tls #define TYPE_SIGNED(type) (/*CONSTCOND*/((type) -1) < 0)
    339       1.5       jtc #endif /* !defined TYPE_SIGNED */
    340       1.5       jtc 
    341       1.1       jtc #ifndef INT_STRLEN_MAXIMUM
    342       1.1       jtc /*
    343       1.1       jtc ** 302 / 1000 is log10(2.0) rounded up.
    344       1.5       jtc ** Subtract one for the sign bit if the type is signed;
    345       1.5       jtc ** add one for integer division truncation;
    346       1.5       jtc ** add one more for a minus sign if the type is signed.
    347       1.1       jtc */
    348       1.1       jtc #define INT_STRLEN_MAXIMUM(type) \
    349      1.25   mlelstv 	((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
    350      1.25   mlelstv 	1 + TYPE_SIGNED(type))
    351       1.1       jtc #endif /* !defined INT_STRLEN_MAXIMUM */
    352       1.1       jtc 
    353       1.1       jtc /*
    354       1.1       jtc ** INITIALIZE(x)
    355       1.1       jtc */
    356       1.1       jtc 
    357       1.1       jtc #ifndef GNUC_or_lint
    358       1.1       jtc #ifdef lint
    359       1.1       jtc #define GNUC_or_lint
    360       1.1       jtc #endif /* defined lint */
    361       1.1       jtc #ifndef lint
    362       1.1       jtc #ifdef __GNUC__
    363       1.1       jtc #define GNUC_or_lint
    364       1.1       jtc #endif /* defined __GNUC__ */
    365       1.1       jtc #endif /* !defined lint */
    366       1.1       jtc #endif /* !defined GNUC_or_lint */
    367       1.1       jtc 
    368       1.1       jtc #ifndef INITIALIZE
    369       1.1       jtc #ifdef GNUC_or_lint
    370       1.1       jtc #define INITIALIZE(x)	((x) = 0)
    371       1.1       jtc #endif /* defined GNUC_or_lint */
    372       1.1       jtc #ifndef GNUC_or_lint
    373       1.1       jtc #define INITIALIZE(x)
    374       1.1       jtc #endif /* !defined GNUC_or_lint */
    375       1.1       jtc #endif /* !defined INITIALIZE */
    376       1.6       jtc 
    377       1.6       jtc /*
    378       1.6       jtc ** For the benefit of GNU folk...
    379       1.6       jtc ** `_(MSGID)' uses the current locale's message library string for MSGID.
    380       1.6       jtc ** The default is to use gettext if available, and use MSGID otherwise.
    381       1.6       jtc */
    382       1.6       jtc 
    383       1.6       jtc #ifndef _
    384      1.25   mlelstv #if HAVE_GETTEXT
    385       1.6       jtc #define _(msgid) gettext(msgid)
    386      1.25   mlelstv #else /* !HAVE_GETTEXT */
    387       1.6       jtc #define _(msgid) msgid
    388      1.25   mlelstv #endif /* !HAVE_GETTEXT */
    389       1.6       jtc #endif /* !defined _ */
    390       1.6       jtc 
    391       1.6       jtc #ifndef TZ_DOMAIN
    392       1.6       jtc #define TZ_DOMAIN "tz"
    393       1.6       jtc #endif /* !defined TZ_DOMAIN */
    394      1.17    kleink 
    395      1.17    kleink #if HAVE_INCOMPATIBLE_CTIME_R
    396      1.17    kleink #undef asctime_r
    397      1.17    kleink #undef ctime_r
    398      1.25   mlelstv char *asctime_r(struct tm const *, char *);
    399      1.25   mlelstv char *ctime_r(time_t const *, char *);
    400      1.17    kleink #endif /* HAVE_INCOMPATIBLE_CTIME_R */
    401       1.1       jtc 
    402      1.25   mlelstv #ifndef YEARSPERREPEAT
    403      1.25   mlelstv #define YEARSPERREPEAT		400	/* years before a Gregorian repeat */
    404      1.25   mlelstv #endif /* !defined YEARSPERREPEAT */
    405      1.25   mlelstv 
    406      1.25   mlelstv /*
    407      1.25   mlelstv ** The Gregorian year averages 365.2425 days, which is 31556952 seconds.
    408      1.25   mlelstv */
    409      1.25   mlelstv 
    410      1.25   mlelstv #ifndef AVGSECSPERYEAR
    411      1.25   mlelstv #define AVGSECSPERYEAR		31556952L
    412      1.25   mlelstv #endif /* !defined AVGSECSPERYEAR */
    413      1.25   mlelstv 
    414      1.25   mlelstv #ifndef SECSPERREPEAT
    415      1.25   mlelstv #define SECSPERREPEAT		((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
    416      1.25   mlelstv #endif /* !defined SECSPERREPEAT */
    417      1.25   mlelstv 
    418      1.25   mlelstv #ifndef SECSPERREPEAT_BITS
    419      1.25   mlelstv #define SECSPERREPEAT_BITS	34	/* ceil(log2(SECSPERREPEAT)) */
    420      1.25   mlelstv #endif /* !defined SECSPERREPEAT_BITS */
    421      1.25   mlelstv 
    422       1.1       jtc /*
    423      1.24    kleink ** UNIX was a registered trademark of The Open Group in 2003.
    424       1.1       jtc */
    425       1.1       jtc 
    426       1.1       jtc #endif /* !defined PRIVATE_H */
    427