| 1419 | return NULL; |
| 1420 | *secsp = num * secsperhour; |
| 1421 | if (*strp == ':') { |
| 1422 | ++strp; |
| 1423 | strp = getnum(strp, &num, 0, MINSPERHOUR - 1); |
| 1424 | if (strp == NULL) |
| 1425 | return NULL; |
| 1426 | *secsp += num * SECSPERMIN; |
| 1427 | if (*strp == ':') { |
| 1428 | ++strp; |
| 1429 | /* 'SECSPERMIN' allows for leap seconds. */ |
| 1430 | strp = getnum(strp, &num, 0, SECSPERMIN); |
| 1431 | if (strp == NULL) |
| 1432 | return NULL; |
| 1433 | *secsp += num; |
| 1434 | } |
| 1435 | } |
| 1436 | return strp; |
| 1437 | } |
| 1438 | |
| 1439 | /* |
| 1440 | ** Given a pointer into a timezone string, extract an offset, in |
| 1441 | ** [+-]hh[:mm[:ss]] form, from the string. |
| 1442 | ** If any error occurs, return NULL. |
| 1443 | ** Otherwise, return a pointer to the first character not part of the time. |
| 1444 | */ |
| 1445 | |
| 1446 | static const char * |
| 1447 | getoffset(register const char *strp, int_fast32_t *const offsetp) |
| 1448 | { |
| 1449 | register bool neg = false; |
| 1450 | |
| 1451 | if (*strp == '-') { |
| 1452 | neg = true; |
| 1453 | ++strp; |
| 1454 | } else if (*strp == '+') |
| 1455 | ++strp; |
| 1456 | strp = getsecs(strp, offsetp); |