src/date_func.h
author Tero Marttila <terom@fixme.fi>
Tue, 22 Jul 2008 23:20:33 +0300
changeset 11184 88c967f1422b
parent 11038 d253e0dfa688
permissions -rw-r--r--
add an empty bin/cache dir
4261
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
     1
/* $Id$ */
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
     2
8636
2b158acb649c (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 6574
diff changeset
     3
/** @file date_func.h Functions related to dates. */
4322
0bee6d9bc452 (svn r5975) -Cleanup: use ORIGINAL_BASE_YEAR & ORIGINAL_MAX_YEAR where the functions really depend on the original date format.
rubidium
parents: 4295
diff changeset
     4
8636
2b158acb649c (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 6574
diff changeset
     5
#ifndef DATE_FUNC_H
2b158acb649c (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 6574
diff changeset
     6
#define DATE_FUNC_H
4322
0bee6d9bc452 (svn r5975) -Cleanup: use ORIGINAL_BASE_YEAR & ORIGINAL_MAX_YEAR where the functions really depend on the original date format.
rubidium
parents: 4295
diff changeset
     7
8636
2b158acb649c (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 6574
diff changeset
     8
#include "date_type.h"
4261
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
     9
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
    10
extern Year      _cur_year;
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
    11
extern Month     _cur_month;
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
    12
extern Date      _date;
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
    13
extern DateFract _date_fract;
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
    14
2ec8f5a9747b (svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
diff changeset
    15
void SetDate(Date date);
4288
60398d0e64ee (svn r5918) -Cleanup: rename ConvertDayToYMD/ConvertYMDToDay as they really convert a Date to/from a YearMonthDay.
rubidium
parents: 4286
diff changeset
    16
void ConvertDateToYMD(Date date, YearMonthDay *ymd);
60398d0e64ee (svn r5918) -Cleanup: rename ConvertDayToYMD/ConvertYMDToDay as they really convert a Date to/from a YearMonthDay.
rubidium
parents: 4286
diff changeset
    17
Date ConvertYMDToDate(Year year, Month month, Day day);
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4329
diff changeset
    18
11038
d253e0dfa688 (svn r13594) -Feature(ette)[FS#2093]: Supply newgrfs with 'day of month', 'leap year' and 'day of year'.
frosch
parents: 8636
diff changeset
    19
static inline bool IsLeapYear(Year yr)
d253e0dfa688 (svn r13594) -Feature(ette)[FS#2093]: Supply newgrfs with 'day of month', 'leap year' and 'day of year'.
frosch
parents: 8636
diff changeset
    20
{
d253e0dfa688 (svn r13594) -Feature(ette)[FS#2093]: Supply newgrfs with 'day of month', 'leap year' and 'day of year'.
frosch
parents: 8636
diff changeset
    21
	return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0);
d253e0dfa688 (svn r13594) -Feature(ette)[FS#2093]: Supply newgrfs with 'day of month', 'leap year' and 'day of year'.
frosch
parents: 8636
diff changeset
    22
}
d253e0dfa688 (svn r13594) -Feature(ette)[FS#2093]: Supply newgrfs with 'day of month', 'leap year' and 'day of year'.
frosch
parents: 8636
diff changeset
    23
8636
2b158acb649c (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 6574
diff changeset
    24
#endif /* DATE_FUNC_H */