Improve thread-safety in DeviceTime.h

Some small thread safety related fixes in DeviceTime.h to prevent race conditions or improper accesses.