capture: store a backreference to CI struct
capture: store per CI instead of global

1) globals stats is recalculated based on CI so it would be overwritten anyway
2) __sync_add_and_fetch isn't present on older versions of gcc (fixes #1)
timesync: fix warnings, remove dead code
timesync: doesn't work with dag legacy