diff options
Diffstat (limited to 'libmailutils')
-rw-r--r-- | libmailutils/datetime/parsedate.y | 14 | ||||
-rw-r--r-- | libmailutils/datetime/scantime.c | 26 |
2 files changed, 39 insertions, 1 deletions
diff --git a/libmailutils/datetime/parsedate.y b/libmailutils/datetime/parsedate.y index 977713001..372cdb2eb 100644 --- a/libmailutils/datetime/parsedate.y +++ b/libmailutils/datetime/parsedate.y @@ -1209,6 +1209,20 @@ mu_parse_date (const char *p, time_t *rettime, const time_t *now) return mu_parse_date_dtl (p, now, rettime, NULL, NULL, NULL); } +int +mu_timezone_offset (const char *buf, int *off) +{ + SYMBOL const *tp; + + for (tp = tz_tab; tp->name; tp++) + if (mu_c_strcasecmp (buf, tp->name) == 0) + { + *off = - tp->value * 60; + return 0; + } + return -1; +} + #ifdef STANDALONE int main (int argc, char *argv[]) diff --git a/libmailutils/datetime/scantime.c b/libmailutils/datetime/scantime.c index 0b118b765..8e19a803b 100644 --- a/libmailutils/datetime/scantime.c +++ b/libmailutils/datetime/scantime.c @@ -538,7 +538,31 @@ mu_scan_datetime (const char *input, const char *fmt, } } break; - + + case 'Z': + /* Time-zone in abbreviated form */ + { + char tzs[6]; + p = mu_str_skip_class_comp (input, MU_CTYPE_SPACE); + n = p - input; + if (n > sizeof (tzs) - 1) + { + rc = MU_ERR_PARSE; + break; + } + memcpy (tzs, input, n); + tzs[n] = 0; + if (mu_timezone_offset (tzs, &n)) + { + rc = MU_ERR_PARSE; + break; + } + if (tz) + tz->utc_offset = n; + input = p; + } + break; + case '%': if (*input == '%') input++; |