1 /* 2 * Copyright (c) 2012-2014 Christian Hansen <chansen@cpan.org> 3 * <https://github.com/chansen/c-dt> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice, this 10 * list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 #ifndef __DT_CONFIG_H__ 27 #define __DT_CONFIG_H__ 28 29 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ 30 (defined(__GNUC__) && __GNUC__ >= 3) || \ 31 (defined(_MSC_VER) && _MSC_VER >= 1800) 32 # include <stdbool.h> 33 #endif 34 35 #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) 36 typedef char _Bool; 37 # define bool _Bool 38 # define true 1 39 # define false 0 40 # define __bool_true_false_are_defined 1 41 #endif 42 43 /* Chronological Julian Date, January 1, 4713 BC, Monday 44 #define DT_EPOCH_OFFSET 1721425 45 */ 46 47 /* Network Time Protocol (NTP), January 1, 1900, Monday 48 #define DT_EPOCH_OFFSET -693596 49 */ 50 51 /* Unix, January 1, 1970, Thursday 52 #define DT_EPOCH_OFFSET -719163 53 */ 54 55 /* Rata Die, January 1, 0001, Monday (as Day 1) */ 56 #define DT_EPOCH_OFFSET 0 57 58 #ifdef __cplusplus 59 extern "C" { 60 #endif 61 62 typedef int dt_t; 63 64 #ifdef __cplusplus 65 } 66 #endif 67 #endif 68