start_time is visible across every thread that runs this function, so every new thread that runs it will overwrite it. Make this local to the function and pass it around where necessary.
start_time