bfc1508d (kx 2023-03-24 03:55:33 +0300 1)
bfc1508d (kx 2023-03-24 03:55:33 +0300 2) #ifndef __DATE_H
bfc1508d (kx 2023-03-24 03:55:33 +0300 3) #define __DATE_H
bfc1508d (kx 2023-03-24 03:55:33 +0300 4)
bfc1508d (kx 2023-03-24 03:55:33 +0300 5) #ifdef __cplusplus
bfc1508d (kx 2023-03-24 03:55:33 +0300 6) extern "C" {
bfc1508d (kx 2023-03-24 03:55:33 +0300 7) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 8)
bfc1508d (kx 2023-03-24 03:55:33 +0300 9) enum date_mode_type {
bfc1508d (kx 2023-03-24 03:55:33 +0300 10) DATE_NORMAL = 0,
bfc1508d (kx 2023-03-24 03:55:33 +0300 11) DATE_HUMAN,
bfc1508d (kx 2023-03-24 03:55:33 +0300 12) DATE_RELATIVE,
bfc1508d (kx 2023-03-24 03:55:33 +0300 13) DATE_SHORT,
bfc1508d (kx 2023-03-24 03:55:33 +0300 14) DATE_ISO8601,
bfc1508d (kx 2023-03-24 03:55:33 +0300 15) DATE_ISO8601_STRICT,
bfc1508d (kx 2023-03-24 03:55:33 +0300 16) DATE_RFC2822,
bfc1508d (kx 2023-03-24 03:55:33 +0300 17) DATE_RAW,
bfc1508d (kx 2023-03-24 03:55:33 +0300 18) DATE_UNIX
bfc1508d (kx 2023-03-24 03:55:33 +0300 19) };
bfc1508d (kx 2023-03-24 03:55:33 +0300 20)
bfc1508d (kx 2023-03-24 03:55:33 +0300 21) struct date_mode {
bfc1508d (kx 2023-03-24 03:55:33 +0300 22) enum date_mode_type type;
bfc1508d (kx 2023-03-24 03:55:33 +0300 23) int local;
bfc1508d (kx 2023-03-24 03:55:33 +0300 24) };
bfc1508d (kx 2023-03-24 03:55:33 +0300 25)
bfc1508d (kx 2023-03-24 03:55:33 +0300 26) /*******************************************************
bfc1508d (kx 2023-03-24 03:55:33 +0300 27) Convenience helper for passing a constant type, like:
bfc1508d (kx 2023-03-24 03:55:33 +0300 28)
bfc1508d (kx 2023-03-24 03:55:33 +0300 29) show_date( t, tz, DATE_MODE(NORMAL) );
bfc1508d (kx 2023-03-24 03:55:33 +0300 30) */
bfc1508d (kx 2023-03-24 03:55:33 +0300 31) #define DATE_MODE(t) date_mode_from_type(DATE_##t)
bfc1508d (kx 2023-03-24 03:55:33 +0300 32) struct date_mode *date_mode_from_type(enum date_mode_type type);
bfc1508d (kx 2023-03-24 03:55:33 +0300 33)
bfc1508d (kx 2023-03-24 03:55:33 +0300 34)
bfc1508d (kx 2023-03-24 03:55:33 +0300 35) /*
bfc1508d (kx 2023-03-24 03:55:33 +0300 36) Parse data in the input TEXT, fill struct tm TM and return
bfc1508d (kx 2023-03-24 03:55:33 +0300 37) UTC time_t. On error parse_data returns -1:
bfc1508d (kx 2023-03-24 03:55:33 +0300 38) */
bfc1508d (kx 2023-03-24 03:55:33 +0300 39) extern time_t parse_date( struct tm *tm, const char *text );
bfc1508d (kx 2023-03-24 03:55:33 +0300 40)
bfc1508d (kx 2023-03-24 03:55:33 +0300 41) extern void show_date_relative( struct strbuf *sb, time_t t );
bfc1508d (kx 2023-03-24 03:55:33 +0300 42) extern void show_date( struct strbuf *sb, time_t t, int tz, const struct date_mode *mode );
bfc1508d (kx 2023-03-24 03:55:33 +0300 43)
bfc1508d (kx 2023-03-24 03:55:33 +0300 44)
bfc1508d (kx 2023-03-24 03:55:33 +0300 45) #ifdef __cplusplus
bfc1508d (kx 2023-03-24 03:55:33 +0300 46) }
bfc1508d (kx 2023-03-24 03:55:33 +0300 47) #endif
bfc1508d (kx 2023-03-24 03:55:33 +0300 48)
bfc1508d (kx 2023-03-24 03:55:33 +0300 49) #endif /* __DATE_H */