Fix inacurate frame timing

All time references are now kept in clock tick to avoid imprecision
due to unit changes. s_last_frame is now updated only when we
effectively encode a frame. s_last_frame and b_start_dumping are now
used in a way similar to the Windows implementation.