"Fossies" - the Fresh Open Source Software Archive

Member "dateutils-0.4.6/contrib/leaps.h" (19 Mar 2019, 2740 Bytes) of package /linux/privat/dateutils-0.4.6.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "leaps.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 0.4.5_vs_0.4.6.

    1 /*** leaps.h -- materialised leap seconds
    2  *
    3  * Copyright (C) 2012-2019 Sebastian Freundt
    4  *
    5  * Author:  Sebastian Freundt <freundt@ga-group.nl>
    6  *
    7  * This file is part of dateutils.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  *
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  *
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * 3. Neither the name of the author nor the names of any contributors
   21  *    may be used to endorse or promote products derived from this
   22  *    software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
   25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   27  * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
   31  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
   33  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
   34  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   35  *
   36  ***/
   37 #if !defined INCLUDED_leaps_h_
   38 #define INCLUDED_leaps_h_
   39 
   40 #include <unistd.h>
   41 #include <stdint.h>
   42 
   43 #if defined __cplusplus
   44 extern "C" {
   45 #endif  /* __cplusplus */
   46 
   47 typedef const struct zleap_s *zleap_t;
   48 typedef const int32_t *zltr_t;
   49 typedef size_t zidx_t;
   50 
   51 /* row-based */
   52 struct zleap_s {
   53     union {
   54         uint32_t u;
   55         int32_t v;
   56     };
   57     int32_t corr;
   58 };
   59 
   60 /* col-based funs */
   61 /**
   62  * Return last leap transition before KEY in a uint32_t field FLD. */
   63 extern zidx_t leaps_before_ui32(const uint32_t fld[], size_t nfld, uint32_t key);
   64 
   65 /**
   66  * Return last leap transition before KEY in a int32_t field FLD. */
   67 extern zidx_t leaps_before_si32(const int32_t fld[], size_t nfld, int32_t key);
   68 
   69 /**
   70  * Return last leap transition before KEY in a uint64_t field FLD. */
   71 extern zidx_t leaps_before_ui64(const uint64_t fld[], size_t nfld, uint64_t key);
   72 
   73 /**
   74  * Return last leap transition before KEY in a int64_t field FLD. */
   75 extern zidx_t leaps_before_si64(const int64_t fld[], size_t nfld, int64_t key);
   76 
   77 #if defined __cplusplus
   78 }
   79 #endif  /* __cplusplus */
   80 
   81 #endif  /* INCLUDED_leaps_h_ */