Update action steps
[slib.git] / include / slib / timedate.h
blob41f40cc504ee4b490e1a2b14661245fa5e5a97f9
1 /*
2 * timedate.h - Time and date operations of the slib
4 * Copyright (C) 2018-2020 Zhang Maiyun
6 * This file is part of the slib.
7 * The slib is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 #ifndef SLIB_TIMEDATE_H
22 #define SLIB_TIMEDATE_H 1
24 #include "slib/general.h"
26 /* leap year: every four years before 1582 or exclude non-four-hundredth if it's
27 * a centennial year */
28 /* leap year here: proleptic */
29 #define isleap(year) (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
31 _BEGIN_EXTERN_C
33 OPT void slib_h2hms(double in_hours, double *out_hours, double *out_minutes,
34 double *out_seconds);
36 OPT double slib_hms2h(double hours, double minutes, double seconds);
38 OPT int slib_d2dn(int year, int month, int day);
40 OPT double slib_true_time_diff(double longitude);
42 OPT double slib_local_time(double longitude, double hours, double timezone);
44 OPT double slib_tm2jd(struct tm *tm);
46 OPT void slib_jd2tm(double jd, struct tm *tm);
48 _END_EXTERN_C
49 #endif