line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* Copyright (c) 2012-2014 Christian Hansen |
3
|
|
|
|
|
|
|
* |
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
|
|
|
|
|
|
|
#include |
27
|
|
|
|
|
|
|
#include "dt_core.h" |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
dt_t |
30
|
0
|
|
|
|
|
|
dt_from_cjdn(int n) { |
31
|
0
|
|
|
|
|
|
return dt_from_rdn(n - 1721425); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
int |
35
|
0
|
|
|
|
|
|
dt_cjdn(dt_t dt) { |
36
|
0
|
|
|
|
|
|
return dt_rdn(dt) + 1721425; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
int |
40
|
1309
|
|
|
|
|
|
dt_year(dt_t dt) { |
41
|
|
|
|
|
|
|
int y; |
42
|
1309
|
|
|
|
|
|
dt_to_yd(dt, &y, NULL); |
43
|
1309
|
|
|
|
|
|
return y; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
int |
47
|
7
|
|
|
|
|
|
dt_quarter(dt_t dt) { |
48
|
|
|
|
|
|
|
int q; |
49
|
7
|
|
|
|
|
|
dt_to_yqd(dt, NULL, &q, NULL); |
50
|
7
|
|
|
|
|
|
return q; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
int |
54
|
847
|
|
|
|
|
|
dt_month(dt_t dt) { |
55
|
|
|
|
|
|
|
int m; |
56
|
847
|
|
|
|
|
|
dt_to_ymd(dt, NULL, &m, NULL); |
57
|
847
|
|
|
|
|
|
return m; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
int |
61
|
413
|
|
|
|
|
|
dt_doy(dt_t dt) { |
62
|
|
|
|
|
|
|
int d; |
63
|
413
|
|
|
|
|
|
dt_to_yd(dt, NULL, &d); |
64
|
413
|
|
|
|
|
|
return d; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
int |
68
|
95
|
|
|
|
|
|
dt_doq(dt_t dt) { |
69
|
|
|
|
|
|
|
int d; |
70
|
95
|
|
|
|
|
|
dt_to_yqd(dt, NULL, NULL, &d); |
71
|
95
|
|
|
|
|
|
return d; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
int |
75
|
851
|
|
|
|
|
|
dt_dom(dt_t dt) { |
76
|
|
|
|
|
|
|
int d; |
77
|
851
|
|
|
|
|
|
dt_to_ymd(dt, NULL, NULL, &d); |
78
|
851
|
|
|
|
|
|
return d; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
int |
82
|
20
|
|
|
|
|
|
dt_woy(dt_t dt) { |
83
|
|
|
|
|
|
|
int w; |
84
|
20
|
|
|
|
|
|
dt_to_ywd(dt, NULL, &w, NULL); |
85
|
20
|
|
|
|
|
|
return w; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
int |
89
|
28
|
|
|
|
|
|
dt_yow(dt_t dt) { |
90
|
|
|
|
|
|
|
int y; |
91
|
28
|
|
|
|
|
|
dt_to_ywd(dt, &y, NULL, NULL); |
92
|
28
|
|
|
|
|
|
return y; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|