File: date-core-private.h

package info (click to toggle)
dateutils 0.4.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,072 kB
  • sloc: ansic: 22,115; makefile: 1,686; yacc: 202; sh: 168; lex: 108
file content (111 lines) | stat: -rw-r--r-- 4,059 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*** date-core-private.h -- our universe of dates, private bits
 *
 * Copyright (C) 2011-2018 Sebastian Freundt
 *
 * Author:  Sebastian Freundt <freundt@ga-group.nl>
 *
 * This file is part of dateutils.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the author nor the names of any contributors
 *    may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 **/
/* private portion of date-core.h */
#if !defined INCLUDED_date_core_private_h_
#define INCLUDED_date_core_private_h_

#include "date-core.h"


/* formatting defaults */
extern const char ymd_dflt[];
extern const char ymcw_dflt[];
extern const char ywd_dflt[];
extern const char yd_dflt[];
extern const char daisy_dflt[];
extern const char bizsi_dflt[];
extern const char bizda_dflt[];

extern const char ymddur_dflt[];
extern const char ymcwdur_dflt[];
extern const char ywddur_dflt[];
extern const char yddur_dflt[];
extern const char daisydur_dflt[];
extern const char bizsidur_dflt[];
extern const char bizdadur_dflt[];

extern dt_dtyp_t __trans_dfmt_special(const char*);
extern dt_dtyp_t __trans_dfmt(const char **fmt);
extern dt_durtyp_t __trans_ddurfmt(const char**fmt);

/**
 * Get the week count of D in the year when weeks start at _1st_wd. */
extern int __yd_get_wcnt(dt_yd_t d, dt_dow_t _1st_wd);

/**
 * Like __yd_get_wcnt() but for ISO week convention. */
extern int __yd_get_wcnt_iso(dt_yd_t d);

/**
 * Like __yd_get_wcnt() but disregard what day the year started with. */
extern int __yd_get_wcnt_abs(dt_yd_t d);

/**
 * Return the N-th W-day in the year of THAT.
 * This is equivalent with 8601's Y-W-D calendar where W is the week
 * of the year and D the day in the week */
extern unsigned int __ymcw_get_yday(dt_ymcw_t that);

/**
 * Get the number of days in month M of year Y. */
extern unsigned int __get_mdays(unsigned int y, unsigned int m);

/**
 * Get the number of business days in month M of year Y. */
extern unsigned int __get_bdays(unsigned int y, unsigned int m);

/**
 * Get the number of ISO weeks in year Y. */
extern unsigned int __get_isowk(unsigned int y);

/**
 * Compare two ymcw objects, return <0, 0, >0 when D1 < D2, D1 == D2, D1 > D2 */
extern int __ymcw_cmp(dt_ymcw_t d1, dt_ymcw_t d2);

/**
 * Get N where N is the N-th occurrence of wday in the month of that year */
extern unsigned int __ymd_get_count(dt_ymd_t that);

/**
 * Crop dates with days beyond ultimo. */
extern __attribute__((pure)) dt_ymd_t __ymd_fixup(dt_ymd_t);
extern __attribute__((pure)) dt_ywd_t __ywd_fixup(dt_ywd_t);
extern __attribute__((pure)) dt_yd_t __yd_fixup(dt_yd_t);
extern __attribute__((pure)) dt_ymcw_t __ymcw_fixup(dt_ymcw_t);
extern __attribute__((pure)) dt_bizda_t __bizda_fixup(dt_bizda_t);

#endif	/* INCLUDED_date_core_private_h_ */