@@ 1,5 1,5 @@
/*
- * Copyright (c) 2016-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2016-2017,2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ 26,6 26,7 @@
#include <jeffpc/error.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <time.h>
static inline uint64_t __gettime(int clock)
@@ 57,4 58,14 @@ static inline uint64_t gettime(void)
return __gettime(CLOCK_REALTIME);
}
+/*
+ * Various functions to deal with gregorian dates.
+ */
+
+/* Is the year leap? */
+static inline bool is_leap_year(int y)
+{
+ return ((y % 4) == 0) && (((y % 400) == 0) || ((y % 100) != 0));
+}
+
#endif