adjusted to use ctime for timing rather than thread/chrono