5 kx
5 kx #ifndef __DATE_H
5 kx #define __DATE_H
5 kx
5 kx #ifdef __cplusplus
5 kx extern "C" {
5 kx #endif
5 kx
5 kx enum date_mode_type {
5 kx DATE_NORMAL = 0,
5 kx DATE_HUMAN,
5 kx DATE_RELATIVE,
5 kx DATE_SHORT,
5 kx DATE_ISO8601,
5 kx DATE_ISO8601_STRICT,
5 kx DATE_RFC2822,
5 kx DATE_RAW,
5 kx DATE_UNIX
5 kx };
5 kx
5 kx struct date_mode {
5 kx enum date_mode_type type;
5 kx int local;
5 kx };
5 kx
5 kx /*******************************************************
5 kx Convenience helper for passing a constant type, like:
5 kx
5 kx show_date( t, tz, DATE_MODE(NORMAL) );
5 kx */
5 kx #define DATE_MODE(t) date_mode_from_type(DATE_##t)
5 kx struct date_mode *date_mode_from_type(enum date_mode_type type);
5 kx
5 kx
5 kx /*
5 kx Parse data in the input TEXT, fill struct tm TM and return
5 kx UTC time_t. On error parse_data returns -1:
5 kx */
5 kx extern time_t parse_date( struct tm *tm, const char *text );
5 kx
5 kx extern void show_date_relative( struct strbuf *sb, time_t t );
5 kx extern void show_date( struct strbuf *sb, time_t t, int tz, const struct date_mode *mode );
5 kx
5 kx
5 kx #ifdef __cplusplus
5 kx }
5 kx #endif
5 kx
5 kx #endif /* __DATE_H */