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

Function tzparse

localtime.c:1631–1811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1629*/
1630
1631static bool
1632tzparse(const char *name, struct state *sp, struct state const *basep)
1633{
1634 const char * stdname;
1635 const char * dstname;
1636 int_fast32_t stdoffset;
1637 int_fast32_t dstoffset;
1638 register char * cp;
1639 ptrdiff_t stdlen, dstlen, charcnt;
1640 time_t atlo = TIME_T_MIN, leaplo = TIME_T_MIN;
1641
1642 stdname = name;
1643 if (*name == '<') {
1644 name++;
1645 stdname = name;
1646 name = getqzname(name, '>');
1647 if (*name != '>')
1648 return false;
1649 stdlen = name - stdname;
1650 name++;
1651 } else {
1652 name = getzname(name);
1653 stdlen = name - stdname;
1654 }
1655 if (! (0 < stdlen && stdlen <= TZNAME_MAXIMUM))
1656 return false;
1657 name = getoffset(name, &stdoffset);
1658 if (name == NULL)
1659 return false;
1660 charcnt = stdlen + 1;
1661 if (basep) {
1662 if (0 < basep->timecnt)
1663 atlo = basep->ats[basep->timecnt - 1];
1664 set_leapcount(sp, leapcount(basep));
1665 if (0 < leapcount(sp)) {
1666 int i;
1667 for (i = 0; i < leapcount(sp); i++)
1668 set_lsinfo(sp, i, lsinfo(basep, i));
1669 leaplo = lsinfo(sp, leapcount(sp) - 1).ls_trans;
1670 }
1671 } else
1672 set_leapcount(sp, 0); /* So, we're off a little. */
1673 sp->goback = sp->goahead = false;
1674 if (*name != '\0') {
1675 struct rule start, end;
1676 int year, yearbeg, yearlim, timecnt;
1677 time_t janfirst;
1678 int_fast32_t janoffset = 0;
1679
1680 if (*name == '<') {
1681 dstname = ++name;
1682 name = getqzname(name, '>');
1683 if (*name != '>')
1684 return false;
1685 dstlen = name - dstname;
1686 name++;
1687 } else {
1688 dstname = name;

Callers 3

tzloadbodyFunction · 0.85
gmtloadFunction · 0.85
zoneinitFunction · 0.85

Calls 13

getqznameFunction · 0.85
getznameFunction · 0.85
getoffsetFunction · 0.85
set_leapcountFunction · 0.85
leapcountFunction · 0.85
set_lsinfoFunction · 0.85
getruleFunction · 0.85
init_ttinfoFunction · 0.85
increment_overflow_timeFunction · 0.85
increment_overflowFunction · 0.85
transtimeFunction · 0.85
mempcpyFunction · 0.85

Tested by

no test coverage detected