X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=date.c;h=c116bbd5f432f54dfa41b6aa991a0caccdd0b972;hp=514f84046ab2998fc36dcd4915f8dab69aa3fc32;hb=cc48812cb55e046a77ce1b4aad33566acc5fbd47;hpb=c2c50d50c572fcd2a015aeba87d33a8ccf5a76b8 diff --git a/date.c b/date.c index 514f8404..c116bbd5 100644 --- a/date.c +++ b/date.c @@ -27,6 +27,8 @@ #include +#include /* For g_ascii_strncasecmp only. */ + #ifndef FALSE #define FALSE 0 #endif @@ -363,6 +365,8 @@ get_tzone (date_token **token) return -1; } +#define HAVE_TIMEZONE + static time_t mktime_utc (struct tm *tm) { @@ -636,30 +640,20 @@ gmime_datetok_table_init (void) } #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)))