libcalendars  0.1.0
cl-julian.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 - Soroush Rabiei, <soroush@ametisco.ir>
3  * This file is part of libcalendar.
4  *
5  * libcalendar is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libcalendar is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with libcalendar. If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef LIBCALENDAR_JULIAN_H
21 #define LIBCALENDAR_JULIAN_H
22 
23 #include <stdint.h>
24 #include "cl-export.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 LIBCALENDAR_API uint8_t ju_is_leap(int16_t year);
31 LIBCALENDAR_API uint8_t ju_days_in_month(uint8_t month, int16_t year);
32 LIBCALENDAR_API uint16_t ju_days_in_year(int16_t year);
33 LIBCALENDAR_API uint8_t ju_month_in_year(int16_t year);
34 LIBCALENDAR_API uint8_t ju_is_valid(int16_t year, uint8_t month, uint16_t day);
35 LIBCALENDAR_API void ju_to_jdn(uint32_t* jd,
36  int16_t year, uint8_t month, uint16_t day);
37 LIBCALENDAR_API void jdn_to_ju(uint32_t jdn,
38  int16_t* year, uint8_t* month, uint16_t* day);
39 LIBCALENDAR_API void ju_to_gr(int16_t jyear, uint8_t jmonth, uint16_t jday,
40  int16_t* gyear, uint8_t* gmonth, uint16_t* gday);
41 LIBCALENDAR_API void gr_to_ju(int16_t gyear, uint8_t gmonth, uint16_t gday,
42  int16_t* jyear, uint8_t* jmonth, uint16_t* jday);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif /* LIBCALENDAR_GREGORIAN_H */
LIBCALENDAR_API uint16_t ju_days_in_year(int16_t year)
Definition: cl-julian.c:59
LIBCALENDAR_API void ju_to_jdn(uint32_t *jd, int16_t year, uint8_t month, uint16_t day)
Definition: cl-julian.c:76
LIBCALENDAR_API void gr_to_ju(int16_t gyear, uint8_t gmonth, uint16_t gday, int16_t *jyear, uint8_t *jmonth, uint16_t *jday)
Definition: cl-julian.c:104
LIBCALENDAR_API uint8_t ju_is_valid(int16_t year, uint8_t month, uint16_t day)
Definition: cl-julian.c:69
LIBCALENDAR_API void jdn_to_ju(uint32_t jdn, int16_t *year, uint8_t *month, uint16_t *day)
Definition: cl-julian.c:84
LIBCALENDAR_API uint8_t ju_month_in_year(int16_t year)
Definition: cl-julian.c:64
LIBCALENDAR_API uint8_t ju_is_leap(int16_t year)
Definition: cl-julian.c:27
#define LIBCALENDAR_API
Definition: cl-export.h:33
LIBCALENDAR_API void ju_to_gr(int16_t jyear, uint8_t jmonth, uint16_t jday, int16_t *gyear, uint8_t *gmonth, uint16_t *gday)
Definition: cl-julian.c:96
LIBCALENDAR_API uint8_t ju_days_in_month(uint8_t month, int16_t year)
Definition: cl-julian.c:32