1 #ifndef EL__PROTOCOL_DATE_H
2 #define EL__PROTOCOL_DATE_H
6 /* Parses YY and YYYY style years. Returns year value ready for tm.tm_year and
7 * move @date pointer after the year if successful else returns -1. */
8 int parse_year(const unsigned char **date
, unsigned char *end
);
10 /* Return 0 for January, 11 for december, -1 for failure. Updates buf pointer on
12 int parse_month(const unsigned char **buf
, unsigned char *end
);
14 /* Return day number. Updates string pointer on success. */
15 int parse_day(const unsigned char **date
, unsigned char *end
);
17 /* Expects HH:MM[:SS] or HH:MM[P|A]M, with HH <= 23, MM <= 59, SS <= 59.
18 * Updates tm, updates time on success and returns 0 on failure, otherwise 1. */
19 int parse_time(const unsigned char **time
, struct tm
*tm
, unsigned char *end
);
21 /* Parses the following date formats:
23 * Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
24 * Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
25 * Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
27 time_t parse_date(unsigned char **date_pos
, unsigned char *end
,
28 int update_pos
, int skip_week_day
);