accumulating the days per year. Convert it to doing a linear scan til the
400 year barrier, then consuming the intervening eras all at once. This
makes the computation effectively constant-time. (It can be improved, by also
jumping forward in centennials, but I wanted to have the easiest-to-read
version first.)
the only non-int64_t version. This catches corner cases where int-valued years
will overflow. While here, don't using the internal mktime-style conversion
code, instead preventing input values from having bad components.
This also adds khttp_epoch2datetime, which symmetrises khttp_datetime2epoch.
timegm(3) as the underlying mechanism instead of relying on hand-rolled functions.
They improve upon timegm(3) in not having ambiguous return values.
Also add regression tests for all new functions.
KUTIL_EPOCH2TM as khttp_epoch2str, khttp_epoch2ustr, khttp_epoch2tms, and
KHTTP_EPOCH2TM, respectively. Internally, these now use gmtime() instead
of the legacy hand-rolled system. They cover a significantly broader range
of time (including negative time values), properly truncate strings in the
the 2str and 2ustr case, and properly handle NULL or zero-length input.
test and compat files. These are now in tests.c and compats.c, and driven
by the configure script. Also remove the MD5 code, which is part of
compats.c. Lastly, move ifdefs to ifs, remove defined (same), and also
remove HAVE_CONFIG_H.