1 #ifndef IMAP_DATE_H 2 #define IMAP_DATE_H 3 4 /* Parses IMAP date/time string and returns TRUE if the string is valid. 5 time_t is filled with UTC date. timezone_offset is filled with parsed 6 timezone. If no timezone is given, local timezone is assumed. 7 8 If date is too low or too high to fit to time_t, it's set to lowest/highest 9 allowed value. This allows you to use the value directly for comparing 10 timestamps. */ 11 bool imap_parse_date(const char *str, time_t *timestamp_r); 12 bool imap_parse_datetime(const char *str, time_t *timestamp_r, 13 int *timezone_offset_r); 14 15 /* Returns given UTC timestamp as IMAP date-time string in local timezone. */ 16 const char *imap_to_datetime(time_t timestamp); 17 /* Returns given UTC timestamp as IMAP date-time string in given timezone. */ 18 const char *imap_to_datetime_tz(time_t timestamp, int timezone_offset); 19 20 /* Returns TRUE if timestamp was successfully converted to a date, 21 FALSE if time would have been required as well (but the string is still 22 returned). */ 23 bool imap_to_date(time_t timestamp, const char **str_r); 24 25 #endif 26