87 #define MAX_DATE_LENGTH 41 92 #define MAX_DATE_BUFFER 256 94 #define SECS_PER_DAY 86400 96 #define SECS_PER_HOUR 3600 98 #define QOF_MOD_DATE "qof-dates" 222 # define qof_date_isleap(year) \ 223 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) 244 #define QOF_UTC_DATE_FORMAT "%Y-%m-%dT%H:%M:%SZ" 253 #define QOF_DATE_FORMAT_US 1 258 #define QOF_DATE_FORMAT_UK 2 263 #define QOF_DATE_FORMAT_CE 3 268 #define QOF_DATE_FORMAT_ISO 4 277 #define QOF_DATE_FORMAT_UTC 5 287 #define QOF_DATE_FORMAT_ISO8601 6 303 #define QOF_DATE_FORMAT_LOCALE 7 319 #define QOF_DATE_FORMAT_CUSTOM 8 322 #define DATE_FORMAT_LAST QOF_DATE_FORMAT_CUSTOM 327 #define QOF_HOUR_TO_SEC(x) (x * SECS_PER_HOUR) 329 #define QOF_MIN_TO_SEC(x) (x * 60) 331 #define QOF_DAYS_TO_SEC(x) (x * SECS_PER_DAY) 501 gboolean track_last_day);
639 qof_date_set_day_end (
QofDate * qd);
642 qof_date_set_day_start (
QofDate * qd);
645 qof_date_set_day_middle (
QofDate * qd);
gint64 qd_year
Extended version to cope with full range of dates.
gboolean qof_date_format_set_current(QofDateFormat df)
Selects one registered date format as the current default.
gboolean qd_valid
If the QofDate is valid or merely initialised.
gboolean qof_date_adddays(QofDate *qd, gint days)
Add a number of days to a QofDate and normalise.
void qof_date_free(QofDate *date)
QofDate * qof_date_from_qtime(const QofTime *qt)
gboolean qof_date_format_set_name(const gchar *name, QofDateFormat format)
Set a shorthand name for a custom date format.
QofDateFormat qof_date_format_from_name(const gchar *name)
Returns the default date format for a known shorthand name.
const gchar * qd_zone
Calculated value based on struct tm.tm_zone.
QofDate * qof_date_get_current(void)
guint8 qof_date_get_mday(gint month, gint64 year)
void qof_date_close(void)
close down the QofDate tables
gchar * qof_date_print(const QofDate *date, QofDateFormat df)
Convert a QofDate to a timestamp according to the specified date format.
gboolean qof_date_format_set_date_separator(const gchar sep, QofDateFormat df)
Set a locale-specific separator.
QofDateFormat qof_date_format_get_current(void)
returns the current date format.
struct QofDate_s QofDate
Full range replacement for struct tm.
const gchar * qof_date_format_get_format(QofDateFormat df)
Retrieve the strftime format string for a registered date format.
QofTime * qof_date_to_qtime(const QofDate *qd)
Full range replacement for struct tm.
gchar qof_date_format_get_date_separator(QofDateFormat df)
Return the field separator for the current date format.
void qof_date_init(void)
initialise the QofDate tables
QofDate * qof_date_parse(const gchar *str, QofDateFormat df)
Convert a timestamp to a QofTime.
glong qd_hour
Signed replacement of struct tm.tm_hour.
glong qd_min
Signed replacement of struct tm.tm_min.
glong qd_mon
Signed replacement of struct tm.tm_mon.
guint16 qof_date_get_yday(gint mday, gint month, gint64 year)
gboolean qof_date_to_struct_tm(const QofDate *qt, struct tm *stm, glong *nanosecs)
Convert a QofDate to a struct tm.
QofDate * qof_date_new_dmy(gint day, gint month, gint64 year)
glong qd_gmt_off
Calculated value based on struct tm.tm_gmtoff.
gboolean qof_date_equal(const QofDate *d1, const QofDate *d2)
64bit UTC Time handling routines
gboolean qof_date_addmonths(QofDate *qd, gint months, gboolean track_last_day)
gboolean qof_date_to_gdate(const QofDate *qd, GDate *gd)
Convert a QofDate to a GDate.
const gchar * qof_date_format_to_name(QofDateFormat format)
Retrieve the shorthand name for the selected date format.
struct QofTime64 QofTime
Use a 64-bit signed int QofTime.
QofDate * qof_date_new(void)
QofTime * qof_date_time_difference(const QofDate *date1, const QofDate *date2)
gint qof_date_compare(const QofDate *d1, const QofDate *d2)
gboolean qof_date_is_last_mday(const QofDate *qd)
glong qd_mday
Signed replacement of struct tm.tm_mday.
QofDate * qof_date_from_gdate(const GDate *gd)
Create a QofDate from a GDate.
gboolean qof_date_format_add(const gchar *str, QofDateFormat *identifier)
Add a specific strftime compatible string as a new QofDateFormat.
gboolean qof_date_valid(QofDate *date)
Validate a QofDate.
QofDate * qof_date_from_struct_tm(const struct tm *stm)
Convert a struct tm to a QofDate.