"Fossies" - the Fresh Open Source Software Archive

Member "dateutils-0.4.6/lib/date-core-private.h" (19 Mar 2019, 4059 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 "date-core-private.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 /*** date-core-private.h -- our universe of dates, private bits
    2  *
    3  * Copyright (C) 2011-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 /* private portion of date-core.h */
   38 #if !defined INCLUDED_date_core_private_h_
   39 #define INCLUDED_date_core_private_h_
   40 
   41 #include "date-core.h"
   42 
   43 
   44 /* formatting defaults */
   45 extern const char ymd_dflt[];
   46 extern const char ymcw_dflt[];
   47 extern const char ywd_dflt[];
   48 extern const char yd_dflt[];
   49 extern const char daisy_dflt[];
   50 extern const char bizsi_dflt[];
   51 extern const char bizda_dflt[];
   52 
   53 extern const char ymddur_dflt[];
   54 extern const char ymcwdur_dflt[];
   55 extern const char ywddur_dflt[];
   56 extern const char yddur_dflt[];
   57 extern const char daisydur_dflt[];
   58 extern const char bizsidur_dflt[];
   59 extern const char bizdadur_dflt[];
   60 
   61 extern dt_dtyp_t __trans_dfmt_special(const char*);
   62 extern dt_dtyp_t __trans_dfmt(const char **fmt);
   63 extern dt_durtyp_t __trans_ddurfmt(const char**fmt);
   64 
   65 /**
   66  * Get the week count of D in the year when weeks start at _1st_wd. */
   67 extern int __yd_get_wcnt(dt_yd_t d, dt_dow_t _1st_wd);
   68 
   69 /**
   70  * Like __yd_get_wcnt() but for ISO week convention. */
   71 extern int __yd_get_wcnt_iso(dt_yd_t d);
   72 
   73 /**
   74  * Like __yd_get_wcnt() but disregard what day the year started with. */
   75 extern int __yd_get_wcnt_abs(dt_yd_t d);
   76 
   77 /**
   78  * Return the N-th W-day in the year of THAT.
   79  * This is equivalent with 8601's Y-W-D calendar where W is the week
   80  * of the year and D the day in the week */
   81 extern unsigned int __ymcw_get_yday(dt_ymcw_t that);
   82 
   83 /**
   84  * Get the number of days in month M of year Y. */
   85 extern unsigned int __get_mdays(unsigned int y, unsigned int m);
   86 
   87 /**
   88  * Get the number of business days in month M of year Y. */
   89 extern unsigned int __get_bdays(unsigned int y, unsigned int m);
   90 
   91 /**
   92  * Get the number of ISO weeks in year Y. */
   93 extern unsigned int __get_isowk(unsigned int y);
   94 
   95 /**
   96  * Compare two ymcw objects, return <0, 0, >0 when D1 < D2, D1 == D2, D1 > D2 */
   97 extern int __ymcw_cmp(dt_ymcw_t d1, dt_ymcw_t d2);
   98 
   99 /**
  100  * Get N where N is the N-th occurrence of wday in the month of that year */
  101 extern unsigned int __ymd_get_count(dt_ymd_t that);
  102 
  103 /**
  104  * Crop dates with days beyond ultimo. */
  105 extern __attribute__((pure)) dt_ymd_t __ymd_fixup(dt_ymd_t);
  106 extern __attribute__((pure)) dt_ywd_t __ywd_fixup(dt_ywd_t);
  107 extern __attribute__((pure)) dt_yd_t __yd_fixup(dt_yd_t);
  108 extern __attribute__((pure)) dt_ymcw_t __ymcw_fixup(dt_ymcw_t);
  109 extern __attribute__((pure)) dt_bizda_t __bizda_fixup(dt_bizda_t);
  110 
  111 #endif  /* INCLUDED_date_core_private_h_ */