Improve thread-safety in DeviceTime.h