/* * Copyright 2015 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_DATE_H #define OCARINA_CORE_DATE_H #include #include struct date { union { struct { uint16_t d_year; uint8_t d_month; uint8_t d_day; }; uint32_t d_stamp; }; }; /* 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 *); void date_read_stamp(struct file *, struct date *); /* Write the date to file. */ void date_write(struct file *, struct date *); void date_write_stamp(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 */