#include <time.h>
+#include <glib.h> /* For g_ascii_strncasecmp only. */
+
#ifndef FALSE
#define FALSE 0
#endif
/* hrm, is there a library for this stuff? */
static struct {
- char *name;
+ const char *name;
int offset;
} tz_offsets [] = {
{ "UT", 0 },
{ "Y", 1200 },
};
-static char *tm_months[] = {
+static const char *tm_months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-static char *tm_days[] = {
+static const char *tm_days[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
return -1;
}
+#define HAVE_TIMEZONE
+
static time_t
mktime_utc (struct tm *tm)
{
}
#endif
-
-/**
- * g_mime_utils_header_decode_date:
- * @str: input date string
- * @tz_offset: timezone offset
- *
- * Decodes the rfc822 date string and saves the GMT offset into
- * @tz_offset if non-NULL.
- *
- * Returns: the time_t representation of the date string specified by
- * @str or (time_t) %0 on error. If @tz_offset is non-NULL, the value
- * of the timezone offset will be stored.
- **/
time_t
-g_mime_utils_header_decode_date (const char *str, int *tz_offset)
+notmuch_parse_date (const char *str, int *tz_offset)
{
date_token *token, *tokens;
time_t date;
-
+
+ if (str == NULL)
+ return 0;
+
if (!(tokens = datetok (str))) {
if (tz_offset)
*tz_offset = 0;
- return (time_t) 0;
+ return 0;
}
if (!(date = parse_rfc822_date (tokens, tz_offset)))