1 /* $OpenBSD: private.h,v 1.39 2019/05/12 12:49:52 schwarze Exp $ */ 2 #ifndef PRIVATE_H 3 4 #define PRIVATE_H 5 6 /* 7 ** This file is in the public domain, so clarified as of 8 ** 1996-06-05 by Arthur David Olson. 9 */ 10 11 /* OpenBSD defaults */ 12 #define PCTS 1 13 #define ALL_STATE 1 14 #define STD_INSPIRED 1 15 16 /* 17 ** This header is for use ONLY with the time conversion code. 18 ** There is no guarantee that it will remain unchanged, 19 ** or that it will remain at all. 20 ** Do NOT copy it to any system include directory. 21 ** Thank you! 22 */ 23 24 #define GRANDPARENTED "Local time zone must be set--see zic manual page" 25 26 /* 27 ** Nested includes 28 */ 29 30 #include <limits.h> /* for CHAR_BIT et al. */ 31 #include <time.h> 32 33 /* 34 ** Finally, some convenience items. 35 */ 36 37 #ifndef TRUE 38 #define TRUE 1 39 #endif /* !defined TRUE */ 40 41 #ifndef FALSE 42 #define FALSE 0 43 #endif /* !defined FALSE */ 44 45 #ifndef TYPE_BIT 46 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) 47 #endif /* !defined TYPE_BIT */ 48 49 #ifndef TYPE_SIGNED 50 #define TYPE_SIGNED(type) (((type) -1) < 0) 51 #endif /* !defined TYPE_SIGNED */ 52 53 #ifndef INT_STRLEN_MAXIMUM 54 /* 55 ** 302 / 1000 is log10(2.0) rounded up. 56 ** Subtract one for the sign bit if the type is signed; 57 ** add one for integer division truncation; 58 ** add one more for a minus sign if the type is signed. 59 */ 60 #define INT_STRLEN_MAXIMUM(type) \ 61 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ 62 1 + TYPE_SIGNED(type)) 63 #endif /* !defined INT_STRLEN_MAXIMUM */ 64 65 #define _(msgid) msgid 66 67 #ifndef TZ_DOMAIN 68 #define TZ_DOMAIN "tz" 69 #endif /* !defined TZ_DOMAIN */ 70 71 #ifndef YEARSPERREPEAT 72 #define YEARSPERREPEAT 400 /* years before a Gregorian repeat */ 73 #endif /* !defined YEARSPERREPEAT */ 74 75 /* 76 ** The Gregorian year averages 365.2425 days, which is 31556952 seconds. 77 */ 78 79 #ifndef AVGSECSPERYEAR 80 #define AVGSECSPERYEAR 31556952L 81 #endif /* !defined AVGSECSPERYEAR */ 82 83 #ifndef SECSPERREPEAT 84 #define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR) 85 #endif /* !defined SECSPERREPEAT */ 86 87 #ifndef SECSPERREPEAT_BITS 88 #define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */ 89 #endif /* !defined SECSPERREPEAT_BITS */ 90 91 #endif /* !defined PRIVATE_H */ 92