MCPcopy Create free account
hub / github.com/eggert/tz / getnum

Function getnum

localtime.c:1392–1411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1390 } while (is_digit(c));
1391 if (num < min)
1392 return NULL; /* illegal value */
1393 *nump = num;
1394 return strp;
1395}
1396
1397/*
1398** Given a pointer into a timezone string, extract a number of seconds,
1399** in hh[:mm[:ss]] form, from the string.
1400** If any error occurs, return NULL.
1401** Otherwise, return a pointer to the first character not part of the number
1402** of seconds.
1403*/
1404
1405static const char *
1406getsecs(register const char *strp, int_fast32_t *const secsp)
1407{
1408 int num;
1409 int_fast32_t secsperhour = SECSPERHOUR;
1410
1411 /*
1412 ** 'HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-POSIX rules like
1413 ** "M10.4.6/26", which does not conform to POSIX,
1414 ** but which specifies the equivalent of

Callers 2

getsecsFunction · 0.85
getruleFunction · 0.85

Calls 1

is_digitFunction · 0.70

Tested by

no test coverage detected