ocarina/include/core/date.h

45 lines
922 B
C

/*
* Copyright 2015 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_DATE_H
#define OCARINA_CORE_DATE_H
#include <core/file.h>
struct date {
unsigned int d_year;
unsigned int d_month;
unsigned int d_day;
};
/* Set the date structure. */
void date_set(struct date *, unsigned int, unsigned int, unsigned int);
/* Set the provided date structure to today's date. */
void date_today(struct date *);
/* Read the date from file. */
void date_read(struct file *, struct date *);
/* Write the date to file. */
void date_write(struct file *, struct date *);
/*
* Convert the date into a string.
* This function allocates a new string that MUST be freed with g_free().
*/
gchar *date_string(const struct date *);
/*
* Compare two dates.
*
* if ret < 0: lhs < rhs.
* if ret = 0: lhs == rhs.
* if ret > 0: lhs > rhs.
*/
int date_compare(const struct date *, const struct date *);
#endif /* OCARINA_CORE_DATE_H */