Make time-based sampling work correctly.

Time-based sampling dynamically adapts the
sample size to the available time.

Time is now specified in ms, rather than s