Fix: Violation of strict weak ordering in engine name sorter
[openttd-github.git] / src / date_func.h
blob58b16bafdcd4ef7b201572fbbe6b147ef5e7bc80
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file date_func.h Functions related to dates. */
10 #ifndef DATE_FUNC_H
11 #define DATE_FUNC_H
13 #include "date_type.h"
15 extern Year _cur_year;
16 extern Month _cur_month;
17 extern Date _date;
18 extern DateFract _date_fract;
19 extern uint16 _tick_counter;
21 void SetDate(Date date, DateFract fract);
22 void ConvertDateToYMD(Date date, YearMonthDay *ymd);
23 Date ConvertYMDToDate(Year year, Month month, Day day);
25 /**
26 * Checks whether the given year is a leap year or not.
27 * @param yr The year to check.
28 * @return True if \c yr is a leap year, otherwise false.
30 static inline bool IsLeapYear(Year yr)
32 return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0);
35 #endif /* DATE_FUNC_H */