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

Function inleap

zic.c:2362–2386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2360}
2361
2362static void
2363inleap(char **fields, int nfields)
2364{
2365 if (nfields != LEAP_FIELDS)
2366 error(N_("wrong number of fields on Leap line"));
2367 else {
2368 zic_t t = getleapdatetime(fields, false);
2369 if (0 <= t) {
2370 struct lookup const *lp = byword(fields[LP_ROLL], leap_types);
2371 if (!lp)
2372 error(N_("invalid Rolling/Stationary field on Leap line"));
2373 else {
2374 int correction = 0;
2375 if (!fields[LP_CORR][0]) /* infile() turns "-" into "". */
2376 correction = -1;
2377 else if (strcmp(fields[LP_CORR], "+") == 0)
2378 correction = 1;
2379 else
2380 error(N_("invalid CORRECTION field on Leap line"));
2381 if (correction)
2382 leapadd(t, correction, lp->l_value);
2383 }
2384 }
2385 }
2386}
2387
2388static void
2389inexpires(char **fields, int nfields)

Callers 1

infileFunction · 0.85

Calls 4

errorFunction · 0.85
getleapdatetimeFunction · 0.85
bywordFunction · 0.85
leapaddFunction · 0.85

Tested by

no test coverage detected