Refactor event loop.

Refactor the event loop to be modular and testable. Also, add support for
detecting corruption of the realtime clock, as can be caused by suspend/resume
cycles without an rtc battery. The event loop is now driven by a tree of events,
which are either sources (currently suspend/resume events, periodic events, and
network route events) or composite events.

Signed-off-by: Elly Fong-Jones <elly@leptoquark.net>
tlsdate: add optional --showtime support for "raw"

Add support for optional arguments to --showtime, "raw" and "human".

Human readable output is what --showtime and -V do already.  Passing
in --showtime=raw will tell tlsdate-helper to write the raw
unix time directly to stdout in host byte order.

The purpose of this change is to provide easier integration of
privilege isolation for time setting.  If tlsdate is called from
a wrapper, like tlsdated, it should be possible to pass the time back
to a privileged time-setter with the minimum of needed parsing.
tlsdate, docs: make -V taken an optional arg to simplify showtime

Update the man pages and simplify the processing of -V
and --showtime to share the optional argument path.
Merge pull request #118 from elly/event-loop

Refactor event loop.
Merge pull request #119 from redpig/showtime=raw

tlsdate: add optional --showtime support for "raw"
Rudimentary support for HTTP Date headers

Since I'm going on a personal crusade to kill off gmt_unix_time, I
should provide an alternative.  That alternative can be the Date
header from HTTP -- unlike gmt_unix_time, the Date header is required
by the RFC to actually be an accurate clock-like clock, and nobody is
trying to get rid of it.

This code is pretty hack-ish and does some nonportable stuff, like
using memmem() and timegm().  It's not super-tolerant of
non-standards-compliant HTTP servers.  I hope I didn't make any
pointer mistakes.
Change check for RTC to be configure based.

Previously I had disabled it with #ifdef __linux__, but that's not
very good autoconf style.
Describe what an HTTP date is
Don't log raw dates, in case they contain junk.
Document magic "1900" value
In verbose mode, display TLS time as well as HTTPS time
Update manpage with http option
Make user-agent a configuration option
Add a changelog
Restrict loggable date fields even harder.
Merge pull request #121 from nmathewson/http_date

Rudimentary support for HTTP Date headers
Define a max length for the HTTP Date: header
Add missing \n
move defines into the proper header
Add README note about HTTP Date parsing