commit 8f95ab787e7964f000e33e0e3d04f3fecde52339
parent edb6b50f0afb2ce279c43e72b2667210e7232187
Author: in0rdr <andreas.gruhler@uzh.ch>
Date: Thu, 15 Dec 2016 15:35:03 +0100
Merge commit 'da8d12a'
Diffstat:
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/diary.c b/diary.c
@@ -9,6 +9,11 @@ struct tm cal_end;
#define DATE_FMT "%Y-%m-%d"
+// normally leap is every 4 years,
+// but is skipped every 100 years,
+// unless it is divisible by 400
+#define is_leap(yr) ((yr % 400 == 0) || (yr % 4 == 0 && yr % 100 != 0))
+
void setup_cal_timeframe()
{
raw_time = time(NULL);
@@ -208,14 +213,6 @@ bool date_has_entry(char* dir, size_t dir_size, struct tm* i)
return (access(epath, F_OK) != -1);
}
-bool is_leap(int year)
-{
- // normally leap is every 4 years,
- // but is skipped every 100 years,
- // unless it is divisible by 400
- return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
-}
-
void get_date_str(struct tm* date, char* date_str, size_t date_str_size)
{
strftime(date_str, date_str_size, DATE_FMT, date);
diff --git a/diary.h b/diary.h
@@ -27,7 +27,6 @@ void display_entry(char* dir, size_t dir_size, struct tm* date, WINDOW* win, int
void edit_cmd(char* dir, size_t dir_size, struct tm* date, char** rcmd, size_t rcmd_size);
bool date_has_entry(char* dir, size_t dir_size, struct tm* i);
-bool is_leap(int year);
void get_date_str(struct tm* date, char* date_str, size_t date_str_size);
void fpath(char* dir, size_t dir_size, struct tm* date, char** rpath, size_t rpath_size);