*
* This code is Copyright (c) 2014, by the authors of nmh.
* See the COPYRIGHT file in the root directory of the nmh
*
* This code is Copyright (c) 2014, by the authors of nmh.
* See the COPYRIGHT file in the root directory of the nmh
-parse_datetime (const char *datetime, const char *zone, int dst,
+parse_datetime (const char *datetime, const char *zone, bool dst,
sscanf (datetime, "%4d%2d%2dT%2d%2d%2d%c",
&tws->tw_year, &tws->tw_mon, &tws->tw_mday,
&tws->tw_hour, &tws->tw_min, &tws->tw_sec,
&utc_indicator);
tws->tw_flags = TW_NULL;
sscanf (datetime, "%4d%2d%2dT%2d%2d%2d%c",
&tws->tw_year, &tws->tw_mon, &tws->tw_mday,
&tws->tw_hour, &tws->tw_min, &tws->tw_sec,
&utc_indicator);
tws->tw_flags = TW_NULL;
if (items_matched == 7) {
/* The 'Z' must be capital according to RFC 5545 Sec. 3.3.5. */
if (utc_indicator != 'Z') {
if (items_matched == 7) {
/* The 'Z' must be capital according to RFC 5545 Sec. 3.3.5. */
if (utc_indicator != 'Z') {
datetime, utc_indicator);
return NOTOK;
}
} else if (zone == NULL) {
datetime, utc_indicator);
return NOTOK;
}
} else if (zone == NULL) {
- if (items_matched >= 6) {
- int offset = atoi (zone ? zone : "0");
-
+ /* items_matched of 3 is for, e.g., 20151230. Assume that means
+ the entire day. The time fields of the tws struct were
+ initialized to 0 by the memset() above. */
+ if (items_matched >= 6 || items_matched == 3) {
set_dotw (tws);
/* set_dotw() sets TW_SIMP. Replace that with TW_SEXP so that
dasctime() outputs the dotw before the date instead of after. */
set_dotw (tws);
/* set_dotw() sets TW_SIMP. Replace that with TW_SEXP so that
dasctime() outputs the dotw before the date instead of after. */
}
tzdesc_t
load_timezones (const contentline *clines) {
tzdesc_t timezones = NULL, timezone = NULL;
}
tzdesc_t
load_timezones (const contentline *clines) {
tzdesc_t timezones = NULL, timezone = NULL;
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was "deleted". */
if (! node->name) { continue; }
for (node = clines; node; node = node->next) {
/* node->name will be NULL if the line was "deleted". */
if (! node->name) { continue; }
&tws) == OK) {
if (tws.tw_year >= 1970) {
/* dmktime() falls apart for, e.g., the year 1601. */
params->start_dt = tws.tw_clock;
}
} else {
&tws) == OK) {
if (tws.tw_year >= 1970) {
/* dmktime() falls apart for, e.g., the year 1601. */
params->start_dt = tws.tw_clock;
}
} else {
} else if (in_vtimezone) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
} else if (in_vtimezone) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
} else if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("STANDARD", node->value)) {
} else if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("STANDARD", node->value)) {
params = &timezone->standard_params;
} else if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("DAYLIGHT", node->value)) {
params = &timezone->standard_params;
} else if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("DAYLIGHT", node->value)) {
params = &timezone->daylight_params;
} else if (! strcasecmp ("TZID", node->name)) {
/* See comment below in format_datetime() about removing any enclosing quotes from a
params = &timezone->daylight_params;
} else if (! strcasecmp ("TZID", node->name)) {
/* See comment below in format_datetime() about removing any enclosing quotes from a
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
if (! strcasecmp ("BEGIN", node->name) &&
! strcasecmp ("VTIMEZONE", node->value)) {
- admonish (NULL,
- "Unsupported RRULE format: %s, assume local timezone",
- rrule);
+ inform("Unsupported RRULE format: %s, assume local timezone, continuing...",
+ rrule);
if (! dt_timezone) {
/* Form #1: DATE WITH LOCAL TIME, i.e., no time zone, or
Form #2: DATE WITH UTC TIME */
if (! dt_timezone) {
/* Form #1: DATE WITH LOCAL TIME, i.e., no time zone, or
Form #2: DATE WITH UTC TIME */
- if (parse_datetime (node->value, NULL, 0, &tws[0]) == OK) {
+ if (parse_datetime (node->value, NULL, false, &tws[0]) == OK) {
Sec. 2) and time zone identifiers are property parameters
(RFC 5545 Sec. 3.8.2.4), though it would seem odd to use
different case in the same file for identifiers that are
Sec. 2) and time zone identifiers are property parameters
(RFC 5545 Sec. 3.8.2.4), though it would seem odd to use
different case in the same file for identifiers that are
"saving time transition precede standard time "
"transition");
return NULL;
}
if (parse_datetime (node->value, tz->standard_params.offsetto,
"saving time transition precede standard time "
"transition");
return NULL;
}
if (parse_datetime (node->value, tz->standard_params.offsetto,