NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
date.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stdbool.h>
31#include <stdint.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <sys/time.h>
35#include <time.h>
36#include "date.h"
37#include "buffer.h"
38#include "logging.h"
39#include "memory.h"
40#include "prex.h"
41#include "regex3.h"
42#include "string2.h"
43
47static const char *const Weekdays[] = {
48 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
49};
50
54static const char *const Months[] = {
55 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
56 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
57};
58
64static const struct Tz TimeZones[] = {
65 // clang-format off
66 { "aat", 1, 0, true }, /* Atlantic Africa Time */
67 { "adt", 4, 0, false }, /* Arabia DST */
68 { "ast", 3, 0, false }, /* Arabia */
69//{ "ast", 4, 0, true }, /* Atlantic */
70 { "bst", 1, 0, false }, /* British DST */
71 { "cat", 1, 0, false }, /* Central Africa */
72 { "cdt", 5, 0, true },
73 { "cest", 2, 0, false }, /* Central Europe DST */
74 { "cet", 1, 0, false }, /* Central Europe */
75 { "cst", 6, 0, true },
76//{ "cst", 8, 0, false }, /* China */
77//{ "cst", 9, 30, false }, /* Australian Central Standard Time */
78 { "eat", 3, 0, false }, /* East Africa */
79 { "edt", 4, 0, true },
80 { "eest", 3, 0, false }, /* Eastern Europe DST */
81 { "eet", 2, 0, false }, /* Eastern Europe */
82 { "egst", 0, 0, false }, /* Eastern Greenland DST */
83 { "egt", 1, 0, true }, /* Eastern Greenland */
84 { "est", 5, 0, true },
85 { "gmt", 0, 0, false },
86 { "gst", 4, 0, false }, /* Presian Gulf */
87 { "hkt", 8, 0, false }, /* Hong Kong */
88 { "ict", 7, 0, false }, /* Indochina */
89 { "idt", 3, 0, false }, /* Israel DST */
90 { "ist", 2, 0, false }, /* Israel */
91//{ "ist", 5, 30, false }, /* India */
92 { "jst", 9, 0, false }, /* Japan */
93 { "kst", 9, 0, false }, /* Korea */
94 { "mdt", 6, 0, true },
95 { "met", 1, 0, false }, /* This is now officially CET */
96 { "met dst", 2, 0, false }, /* MET in Daylight Saving Time */
97 { "msd", 4, 0, false }, /* Moscow DST */
98 { "msk", 3, 0, false }, /* Moscow */
99 { "mst", 7, 0, true },
100 { "nzdt", 13, 0, false }, /* New Zealand DST */
101 { "nzst", 12, 0, false }, /* New Zealand */
102 { "pdt", 7, 0, true },
103 { "pst", 8, 0, true },
104 { "sat", 2, 0, false }, /* South Africa */
105 { "smt", 4, 0, false }, /* Seychelles */
106 { "sst", 11, 0, true }, /* Samoa */
107//{ "sst", 8, 0, false }, /* Singapore */
108 { "utc", 0, 0, false },
109 { "wat", 0, 0, false }, /* West Africa */
110 { "west", 1, 0, false }, /* Western Europe DST */
111 { "wet", 0, 0, false }, /* Western Europe */
112 { "wgst", 2, 0, true }, /* Western Greenland DST */
113 { "wgt", 3, 0, true }, /* Western Greenland */
114 { "wst", 8, 0, false }, /* Western Australia */
115 // clang-format on
116};
117
127static int compute_tz(time_t g, struct tm *utc)
128{
129 struct tm lt = mutt_date_localtime(g);
130
131 int tz = (((lt.tm_hour - utc->tm_hour) * 60) + (lt.tm_min - utc->tm_min)) * 60;
132
133 int yday = (lt.tm_yday - utc->tm_yday);
134 if (yday != 0)
135 {
136 /* This code is optimized to negative timezones (West of Greenwich) */
137 if ((yday == -1) || /* UTC passed midnight before localtime */
138 (yday > 1)) /* UTC passed new year before localtime */
139 {
140 tz -= (24 * 60 * 60);
141 }
142 else
143 {
144 tz += (24 * 60 * 60);
145 }
146 }
147
148 return tz;
149}
150
159static time_t add_tz_offset(time_t t, bool w, time_t h, time_t m)
160{
161 if ((t != TIME_T_MAX) && (t != TIME_T_MIN))
162 return t + (w ? 1 : -1) * (((time_t) h * 3600) + ((time_t) m * 60));
163 else
164 return t;
165}
166
174static const struct Tz *find_tz(const char *s, size_t len)
175{
176 for (size_t i = 0; i < mutt_array_size(TimeZones); i++)
177 {
178 if (mutt_istrn_equal(TimeZones[i].tzname, s, len))
179 return &TimeZones[i];
180 }
181 return NULL;
182}
183
189static int is_leap_year_feb(struct tm *tm)
190{
191 if (tm->tm_mon != 1)
192 return 0;
193
194 int y = tm->tm_year + 1900;
195 return ((y & 3) == 0) && (((y % 100) != 0) || ((y % 400) == 0));
196}
197
207{
208 /* Check we haven't overflowed the time (on 32-bit arches) */
209 if ((t == TIME_T_MAX) || (t == TIME_T_MIN))
210 return 0;
211
212 if (t == 0)
213 t = mutt_date_epoch();
214
215 struct tm tm = mutt_date_gmtime(t);
216 return compute_tz(t, &tm);
217}
218
229time_t mutt_date_make_time(struct tm *t, bool local)
230{
231 if (!t)
232 return TIME_T_MIN;
233
234 static const int AccumDaysPerMonth[mutt_array_size(Months)] = {
235 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
236 };
237
238 /* Prevent an integer overflow, with some arbitrary limits. */
239 if (t->tm_year > 10000)
240 return TIME_T_MAX;
241 if (t->tm_year < -10000)
242 return TIME_T_MIN;
243
244 if ((t->tm_mday < 1) || (t->tm_mday > 31))
245 return TIME_T_MIN;
246 if ((t->tm_hour < 0) || (t->tm_hour > 23) || (t->tm_min < 0) ||
247 (t->tm_min > 59) || (t->tm_sec < 0) || (t->tm_sec > 60))
248 {
249 return TIME_T_MIN;
250 }
251 if (t->tm_year > 9999)
252 return TIME_T_MAX;
253
254 /* Compute the number of days since January 1 in the same year */
255 int yday = AccumDaysPerMonth[t->tm_mon % mutt_array_size(Months)];
256
257 /* The leap years are 1972 and every 4. year until 2096,
258 * but this algorithm will fail after year 2099 */
259 yday += t->tm_mday;
260 if ((t->tm_year % 4) || (t->tm_mon < 2))
261 yday--;
262 t->tm_yday = yday;
263
264 time_t g = yday;
265
266 /* Compute the number of days since January 1, 1970 */
267 g += (t->tm_year - 70) * (time_t) 365;
268 g += (t->tm_year - 69) / 4;
269
270 /* Compute the number of hours */
271 g *= 24;
272 g += t->tm_hour;
273
274 /* Compute the number of minutes */
275 g *= 60;
276 g += t->tm_min;
277
278 /* Compute the number of seconds */
279 g *= 60;
280 g += t->tm_sec;
281
282 if (local)
283 g -= compute_tz(g, t);
284
285 return g;
286}
287
297void mutt_date_normalize_time(struct tm *tm)
298{
299 if (!tm)
300 return;
301
302 static const char DaysPerMonth[mutt_array_size(Months)] = {
303 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
304 };
305 int leap;
306
307 while (tm->tm_sec < 0)
308 {
309 tm->tm_sec += 60;
310 tm->tm_min--;
311 }
312 while (tm->tm_sec >= 60)
313 {
314 tm->tm_sec -= 60;
315 tm->tm_min++;
316 }
317 while (tm->tm_min < 0)
318 {
319 tm->tm_min += 60;
320 tm->tm_hour--;
321 }
322 while (tm->tm_min >= 60)
323 {
324 tm->tm_min -= 60;
325 tm->tm_hour++;
326 }
327 while (tm->tm_hour < 0)
328 {
329 tm->tm_hour += 24;
330 tm->tm_mday--;
331 }
332 while (tm->tm_hour >= 24)
333 {
334 tm->tm_hour -= 24;
335 tm->tm_mday++;
336 }
337 /* use loops on NNNdwmy user input values? */
338 while (tm->tm_mon < 0)
339 {
340 tm->tm_mon += 12;
341 tm->tm_year--;
342 }
343 while (tm->tm_mon >= 12)
344 {
345 tm->tm_mon -= 12;
346 tm->tm_year++;
347 }
348 while (tm->tm_mday <= 0)
349 {
350 if (tm->tm_mon)
351 tm->tm_mon--;
352 else
353 {
354 tm->tm_mon = 11;
355 tm->tm_year--;
356 }
357 tm->tm_mday += DaysPerMonth[tm->tm_mon] + is_leap_year_feb(tm);
358 }
359 while (tm->tm_mday > (DaysPerMonth[tm->tm_mon] + (leap = is_leap_year_feb(tm))))
360 {
361 tm->tm_mday -= DaysPerMonth[tm->tm_mon] + leap;
362 if (tm->tm_mon < 11)
363 tm->tm_mon++;
364 else
365 {
366 tm->tm_mon = 0;
367 tm->tm_year++;
368 }
369 }
370}
371
380void mutt_date_make_date(struct Buffer *buf, bool local)
381{
382 if (!buf)
383 return;
384
385 struct tm tm;
386 int tz = 0;
387
388 time_t t = mutt_date_epoch();
389 if (local)
390 {
391 tm = mutt_date_localtime(t);
392 tz = mutt_date_local_tz(t);
393 }
394 else
395 {
396 tm = mutt_date_gmtime(t);
397 }
398
399 tz /= 60;
400
401 mutt_buffer_add_printf(buf, "%s, %d %s %d %02d:%02d:%02d %+03d%02d", Weekdays[tm.tm_wday],
402 tm.tm_mday, Months[tm.tm_mon], tm.tm_year + 1900,
403 tm.tm_hour, tm.tm_min, tm.tm_sec, tz / 60, abs(tz) % 60);
404}
405
415int mutt_date_check_month(const char *s)
416{
417 for (int i = 0; i < mutt_array_size(Months); i++)
418 if (mutt_istr_startswith(s, Months[i]))
419 return i;
420
421 return -1; /* error */
422}
423
428time_t mutt_date_epoch(void)
429{
430 return mutt_date_epoch_ms() / 1000;
431}
432
437uint64_t mutt_date_epoch_ms(void)
438{
439 struct timeval tv = { 0, 0 };
440 gettimeofday(&tv, NULL);
441 /* We assume that gettimeofday doesn't modify its first argument on failure.
442 * We also kind of assume that gettimeofday does not fail. */
443 return (uint64_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
444}
445
457time_t mutt_date_parse_date(const char *s, struct Tz *tz_out)
458{
459 if (!s)
460 return -1;
461
462 bool lax = false;
463
464 const regmatch_t *match = mutt_prex_capture(PREX_RFC5322_DATE, s);
465 if (!match)
466 {
468 if (!match)
469 {
470 mutt_debug(LL_DEBUG1, "Could not parse date: <%s>\n", s);
471 return -1;
472 }
473 lax = true;
474 mutt_debug(LL_DEBUG2, "Fallback regex for date: <%s>\n", s);
475 }
476
477 struct tm tm = { 0 };
478
479 // clang-format off
480 const regmatch_t *mday = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_DAY : PREX_RFC5322_DATE_MATCH_DAY];
481 const regmatch_t *mmonth = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_MONTH : PREX_RFC5322_DATE_MATCH_MONTH];
482 const regmatch_t *myear = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_YEAR : PREX_RFC5322_DATE_MATCH_YEAR];
483 const regmatch_t *mhour = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_HOUR : PREX_RFC5322_DATE_MATCH_HOUR];
484 const regmatch_t *mminute = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_MINUTE : PREX_RFC5322_DATE_MATCH_MINUTE];
485 const regmatch_t *msecond = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_SECOND : PREX_RFC5322_DATE_MATCH_SECOND];
486 const regmatch_t *mtz = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_TZ : PREX_RFC5322_DATE_MATCH_TZ];
487 const regmatch_t *mtzobs = &match[lax ? PREX_RFC5322_DATE_LAX_MATCH_TZ_OBS : PREX_RFC5322_DATE_MATCH_TZ_OBS];
488 // clang-format on
489
490 /* Day */
491 sscanf(s + mutt_regmatch_start(mday), "%d", &tm.tm_mday);
492 if (tm.tm_mday > 31)
493 return -1;
494
495 /* Month */
496 tm.tm_mon = mutt_date_check_month(s + mutt_regmatch_start(mmonth));
497
498 /* Year */
499 sscanf(s + mutt_regmatch_start(myear), "%d", &tm.tm_year);
500 if (tm.tm_year < 50)
501 tm.tm_year += 100;
502 else if (tm.tm_year >= 1900)
503 tm.tm_year -= 1900;
504
505 /* Time */
506 int hour, min, sec = 0;
507 sscanf(s + mutt_regmatch_start(mhour), "%d", &hour);
508 sscanf(s + mutt_regmatch_start(mminute), "%d", &min);
509 if (mutt_regmatch_start(msecond) != -1)
510 sscanf(s + mutt_regmatch_start(msecond), "%d", &sec);
511 if ((hour > 23) || (min > 59) || (sec > 60))
512 return -1;
513 tm.tm_hour = hour;
514 tm.tm_min = min;
515 tm.tm_sec = sec;
516
517 /* Time zone */
518 int zhours = 0;
519 int zminutes = 0;
520 bool zoccident = false;
521 if (mutt_regmatch_start(mtz) != -1)
522 {
523 char direction;
524 sscanf(s + mutt_regmatch_start(mtz), "%c%02d%02d", &direction, &zhours, &zminutes);
525 zoccident = (direction == '-');
526 }
527 else if (mutt_regmatch_start(mtzobs) != -1)
528 {
529 const struct Tz *tz = find_tz(s + mutt_regmatch_start(mtzobs),
530 mutt_regmatch_len(mtzobs));
531 if (tz)
532 {
533 zhours = tz->zhours;
534 zminutes = tz->zminutes;
535 zoccident = tz->zoccident;
536 }
537 }
538
539 if (tz_out)
540 {
541 tz_out->zhours = zhours;
542 tz_out->zminutes = zminutes;
543 tz_out->zoccident = zoccident;
544 }
545
547}
548
558int mutt_date_make_imap(char *buf, size_t buflen, time_t timestamp)
559{
560 if (!buf)
561 return -1;
562
563 struct tm tm = mutt_date_localtime(timestamp);
565
566 tz /= 60;
567
568 return snprintf(buf, buflen, "%02d-%s-%d %02d:%02d:%02d %+03d%02d",
569 tm.tm_mday, Months[tm.tm_mon], tm.tm_year + 1900, tm.tm_hour,
570 tm.tm_min, tm.tm_sec, tz / 60, abs(tz) % 60);
571}
572
584int mutt_date_make_tls(char *buf, size_t buflen, time_t timestamp)
585{
586 if (!buf)
587 return -1;
588
589 struct tm tm = mutt_date_gmtime(timestamp);
590 return snprintf(buf, buflen, "%s, %d %s %d %02d:%02d:%02d UTC",
591 Weekdays[tm.tm_wday], tm.tm_mday, Months[tm.tm_mon],
592 tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
593}
594
601time_t mutt_date_parse_imap(const char *s)
602{
603 const regmatch_t *match = mutt_prex_capture(PREX_IMAP_DATE, s);
604 if (!match)
605 return 0;
606
607 const regmatch_t *mday = &match[PREX_IMAP_DATE_MATCH_DAY];
608 const regmatch_t *mmonth = &match[PREX_IMAP_DATE_MATCH_MONTH];
609 const regmatch_t *myear = &match[PREX_IMAP_DATE_MATCH_YEAR];
610 const regmatch_t *mtime = &match[PREX_IMAP_DATE_MATCH_TIME];
611 const regmatch_t *mtz = &match[PREX_IMAP_DATE_MATCH_TZ];
612
613 struct tm tm;
614
615 sscanf(s + mutt_regmatch_start(mday), " %d", &tm.tm_mday);
616 tm.tm_mon = mutt_date_check_month(s + mutt_regmatch_start(mmonth));
617 sscanf(s + mutt_regmatch_start(myear), "%d", &tm.tm_year);
618 tm.tm_year -= 1900;
619 sscanf(s + mutt_regmatch_start(mtime), "%d:%d:%d", &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
620
621 char direction;
622 int zhours, zminutes;
623 sscanf(s + mutt_regmatch_start(mtz), "%c%02d%02d", &direction, &zhours, &zminutes);
624 bool zoccident = (direction == '-');
625
626 return add_tz_offset(mutt_date_make_time(&tm, false), zoccident, zhours, zminutes);
627}
628
637time_t mutt_date_add_timeout(time_t now, time_t timeout)
638{
639 if (timeout < 0)
640 return now;
641
642 if ((TIME_T_MAX - now) < timeout)
643 return TIME_T_MAX;
644
645 return now + timeout;
646}
647
655struct tm mutt_date_localtime(time_t t)
656{
657 struct tm tm = { 0 };
658
659 if (t == MUTT_DATE_NOW)
660 t = mutt_date_epoch();
661
662 localtime_r(&t, &tm);
663 return tm;
664}
665
673struct tm mutt_date_gmtime(time_t t)
674{
675 struct tm tm = { 0 };
676
677 if (t == MUTT_DATE_NOW)
678 t = mutt_date_epoch();
679
680 gmtime_r(&t, &tm);
681 return tm;
682}
683
692size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
693{
694 if (!buf || !format)
695 return 0;
696
697 struct tm tm = mutt_date_localtime(t);
698 return strftime(buf, buflen, format, &tm);
699}
700
705void mutt_date_sleep_ms(size_t ms)
706{
707 const struct timespec sleep = {
708 .tv_sec = ms / 1000,
709 .tv_nsec = (ms % 1000) * 1000000UL,
710 };
711 nanosleep(&sleep, NULL);
712}
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:211
General purpose object for storing and parsing strings.
struct tm mutt_date_localtime(time_t t)
Converts calendar time to a broken-down time structure expressed in user timezone.
Definition: date.c:655
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:692
static int compute_tz(time_t g, struct tm *utc)
Calculate the number of seconds east of UTC.
Definition: date.c:127
void mutt_date_make_date(struct Buffer *buf, bool local)
Write a date in RFC822 format to a buffer.
Definition: date.c:380
time_t mutt_date_make_time(struct tm *t, bool local)
Convert struct tm to time_t
Definition: date.c:229
static const char *const Months[]
Months of the year (abbreviated)
Definition: date.c:54
void mutt_date_sleep_ms(size_t ms)
Sleep for milliseconds.
Definition: date.c:705
int mutt_date_check_month(const char *s)
Is the string a valid month name.
Definition: date.c:415
static const struct Tz * find_tz(const char *s, size_t len)
Look up a timezone.
Definition: date.c:174
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone.
Definition: date.c:673
int mutt_date_make_tls(char *buf, size_t buflen, time_t timestamp)
Format date in TLS certificate verification style.
Definition: date.c:584
static int is_leap_year_feb(struct tm *tm)
Is a given February in a leap year.
Definition: date.c:189
time_t mutt_date_epoch(void)
Return the number of seconds since the Unix epoch.
Definition: date.c:428
static const char *const Weekdays[]
Day of the week (abbreviated)
Definition: date.c:47
int mutt_date_make_imap(char *buf, size_t buflen, time_t timestamp)
Format date in IMAP style: DD-MMM-YYYY HH:MM:SS +ZZzz.
Definition: date.c:558
int mutt_date_local_tz(time_t t)
Calculate the local timezone in seconds east of UTC.
Definition: date.c:206
time_t mutt_date_add_timeout(time_t now, time_t timeout)
Safely add a timeout to a given time_t value.
Definition: date.c:637
static const struct Tz TimeZones[]
Lookup table of Time Zones.
Definition: date.c:64
time_t mutt_date_parse_date(const char *s, struct Tz *tz_out)
Parse a date string in RFC822 format.
Definition: date.c:457
time_t mutt_date_parse_imap(const char *s)
Parse date of the form: DD-MMM-YYYY HH:MM:SS +ZZzz.
Definition: date.c:601
void mutt_date_normalize_time(struct tm *tm)
Fix the contents of a struct tm.
Definition: date.c:297
uint64_t mutt_date_epoch_ms(void)
Return the number of milliseconds since the Unix epoch.
Definition: date.c:437
static time_t add_tz_offset(time_t t, bool w, time_t h, time_t m)
Compute and add a timezone offset to an UTC time.
Definition: date.c:159
Time and date handling routines.
#define TIME_T_MAX
Definition: date.h:33
#define MUTT_DATE_NOW
Constant representing the 'current time', see: mutt_date_gmtime(), mutt_date_localtime()
Definition: date.h:39
#define TIME_T_MIN
Definition: date.h:34
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
static const char * timestamp(time_t stamp)
Create a YYYY-MM-DD HH:MM:SS timestamp.
Definition: logging.c:77
Logging Dispatcher.
@ LL_DEBUG2
Log at debug level 2.
Definition: logging.h:41
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
Memory management wrappers.
#define mutt_array_size(x)
Definition: memory.h:36
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition: string.c:239
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
Definition: string.c:524
regmatch_t * mutt_prex_capture(enum Prex which, const char *str)
Match a precompiled regex against a string.
Definition: prex.c:308
Manage precompiled / predefined regular expressions.
@ PREX_IMAP_DATE_MATCH_TIME
15-MAR-2020 [15:09:35] -0700
Definition: prex.h:190
@ PREX_IMAP_DATE_MATCH_YEAR
15-MAR-[2020] 15:09:35 -0700
Definition: prex.h:189
@ PREX_IMAP_DATE_MATCH_DAY
[ 4]-MAR-2020 15:09:35 -0700
Definition: prex.h:185
@ PREX_IMAP_DATE_MATCH_TZ
15-MAR-2020 15:09:35 [-0700]
Definition: prex.h:191
@ PREX_IMAP_DATE_MATCH_MONTH
15-[MAR]-2020 15:09:35 -0700
Definition: prex.h:188
@ PREX_RFC5322_DATE_MATCH_TZ_OBS
Tue, 3 Mar 2020 14:32:55[UT]
Definition: prex.h:135
@ PREX_RFC5322_DATE_MATCH_TZ
Tue, 3 Mar 2020 14:32:55 [+0200]
Definition: prex.h:134
@ PREX_RFC5322_DATE_MATCH_SECOND
Tue, 3 Mar 2020 14:32:[55] +0200
Definition: prex.h:132
@ PREX_RFC5322_DATE_MATCH_YEAR
Tue, 3 Mar [2020] 14:32:55 +0200
Definition: prex.h:128
@ PREX_RFC5322_DATE_MATCH_HOUR
Tue, 3 Mar 2020 [14]:32:55 +0200
Definition: prex.h:129
@ PREX_RFC5322_DATE_MATCH_DAY
Tue, [3] Mar 2020 14:32:55 +0200
Definition: prex.h:126
@ PREX_RFC5322_DATE_MATCH_MINUTE
Tue, 3 Mar 2020 14:[32]:55 +0200
Definition: prex.h:130
@ PREX_RFC5322_DATE_MATCH_MONTH
Tue, 3 [Jan] 2020 14:32:55 +0200
Definition: prex.h:127
@ PREX_IMAP_DATE
[16-MAR-2020 15:09:35 -0700]
Definition: prex.h:39
@ PREX_RFC5322_DATE
[Mon, 16 Mar 2020 15:09:35 -0700]
Definition: prex.h:37
@ PREX_RFC5322_DATE_LAX
[Mon, (Comment) 16 Mar 2020 15:09:35 -0700]
Definition: prex.h:38
@ PREX_RFC5322_DATE_LAX_MATCH_SECOND
Tue, 3 Mar 2020 14:32:[55] +0200
Definition: prex.h:169
@ PREX_RFC5322_DATE_LAX_MATCH_TZ
Tue, 3 Mar 2020 14:32:55 [+0200]
Definition: prex.h:172
@ PREX_RFC5322_DATE_LAX_MATCH_YEAR
Tue, 3 Mar [2020] 14:32:55 +0200
Definition: prex.h:161
@ PREX_RFC5322_DATE_LAX_MATCH_HOUR
Tue, 3 Mar 2020 [14]:32:55 +0200
Definition: prex.h:163
@ PREX_RFC5322_DATE_LAX_MATCH_MINUTE
Tue, 3 Mar 2020 14:[32]:55 +0200
Definition: prex.h:165
@ PREX_RFC5322_DATE_LAX_MATCH_TZ_OBS
Tue, 3 Mar 2020 14:32:55[UT]
Definition: prex.h:173
@ PREX_RFC5322_DATE_LAX_MATCH_MONTH
Tue, 3 [Jan] 2020 14:32:55 +0200
Definition: prex.h:159
@ PREX_RFC5322_DATE_LAX_MATCH_DAY
Tue, [3] Mar 2020 14:32:55 +0200
Definition: prex.h:157
Manage regular expressions.
static size_t mutt_regmatch_len(const regmatch_t *match)
Return the length of a match.
Definition: regex3.h:80
static regoff_t mutt_regmatch_start(const regmatch_t *match)
Return the start of a match.
Definition: regex3.h:60
String manipulation functions.
String manipulation buffer.
Definition: buffer.h:34
List of recognised Timezones.
Definition: date.h:45
unsigned char zminutes
Minutes away from UTC.
Definition: date.h:48
bool zoccident
True if west of UTC, False if East.
Definition: date.h:49
char tzname[8]
Name, e.g. UTC.
Definition: date.h:46
unsigned char zhours
Hours away from UTC.
Definition: date.h:47
Time value with nanosecond precision.
Definition: file.h:49
time_t tv_sec
Number of seconds since the epoch.
Definition: file.h:50