Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t188 #3819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

t188 #3819

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions lib/common/iso8601.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,22 +809,18 @@ crm_time_parse_offset(const char *offset_str, int *offset)

*offset = 0;
if ((offset_str[0] == '+') || (offset_str[0] == '-')
|| isdigit((int)offset_str[0])) {
|| isdigit(offset_str[0])) {

gboolean negate = FALSE;
*offset = crm_time_parse_sec(offset_str + !isdigit(offset_str[0]), offset);

if (offset_str[0] == '+') {
offset_str++;
} else if (offset_str[0] == '-') {
negate = TRUE;
offset_str++;
*offset = -*offset;
}
if (crm_time_parse_sec(offset_str, offset) == FALSE) {
return FALSE;
}
if (negate) {
*offset = 0 - *offset;
}
} // @TODO else invalid?
return TRUE;
}
Expand All @@ -843,22 +839,18 @@ static bool
crm_time_parse(const char *time_str, crm_time_t *a_time)
{
uint32_t h, m, s;
char *offset_s = NULL;
const char *offset_s = NULL;

tzset();

if (time_str) {
if (crm_time_parse_sec(time_str, &(a_time->seconds)) == FALSE) {
return FALSE;
}
offset_s = strstr(time_str, "Z");
if (offset_s == NULL) {
offset_s = strstr(time_str, " ");
if (offset_s) {
while (isspace(offset_s[0])) {
offset_s++;
}
}
/* standard doesn't allow spaces, but be/stay tolerant */
offset_s = time_str + strcspn(time_str, " \f\n\r\t\v-+Z");
while (isspace(*offset_s)) {
offset_s++;
}
}

Expand Down