gettime: fix race/bug with threads and time keeping