/src/ntp-dev/libntp/ymd2yd.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * ymd2yd - compute the date in the year from y/m/d |
3 | | * |
4 | | * A thin wrapper around a more general calendar function. |
5 | | */ |
6 | | |
7 | | #include <config.h> |
8 | | #include "ntp_stdlib.h" |
9 | | #include "ntp_calendar.h" |
10 | | |
11 | | int |
12 | | ymd2yd( |
13 | | int y, |
14 | | int m, |
15 | | int d) |
16 | 0 | { |
17 | | /* |
18 | | * convert y/m/d to elapsed calendar units, convert that to |
19 | | * elapsed days since the start of the given year and convert |
20 | | * back to unity-based day in year. |
21 | | * |
22 | | * This does no further error checking, since the underlying |
23 | | * function is assumed to work out how to handle the data. |
24 | | */ |
25 | 0 | return ntpcal_edate_to_yeardays(y-1, m-1, d-1) + 1; |
26 | 0 | } |