Initialize *SP to a value appropriate for the TZ setting NAME. Respect TZLOADFLAGS. Return 0 on success, an errno value on failure. */
| 1839 | Respect TZLOADFLAGS. |
| 1840 | Return 0 on success, an errno value on failure. */ |
| 1841 | static int |
| 1842 | zoneinit(struct state *sp, char const *name, char tzloadflags) |
| 1843 | { |
| 1844 | if (name && ! name[0]) { |
| 1845 | /* |
| 1846 | ** User wants it fast rather than right. |
| 1847 | */ |
| 1848 | set_leapcount(sp, 0); /* so, we're off a little */ |
| 1849 | sp->timecnt = 0; |
| 1850 | sp->typecnt = 0; |
| 1851 | sp->charcnt = 0; |
| 1852 | sp->goback = sp->goahead = false; |
| 1853 | init_ttinfo(&sp->ttis[0], 0, false, 0); |
| 1854 | strcpy(sp->chars, utc); |
| 1855 | return 0; |
| 1856 | } else { |
| 1857 | int err = tzload(name, sp, tzloadflags); |
| 1858 | if (err != 0 && name && name[0] != ':' && !(tzloadflags & TZLOAD_TZDIR_SUB) |
| 1859 | && tzparse(name, sp, NULL)) |
| 1860 | err = 0; |
| 1861 | if (err == 0) |
| 1862 | err = scrub_abbrs(sp); |
| 1863 | return err; |
| 1864 | } |
| 1865 | } |
| 1866 | |
| 1867 | /* If THREADED, upgrade a read lock to a write lock. |
| 1868 | Return 0 on success, a positive errno value otherwise. */ |
no test coverage detected