diff --git a/modules/libcom/src/osi/os/vxWorks/osdTime.cpp b/modules/libcom/src/osi/os/vxWorks/osdTime.cpp index 59bc5c87a..2fe679153 100644 --- a/modules/libcom/src/osi/os/vxWorks/osdTime.cpp +++ b/modules/libcom/src/osi/os/vxWorks/osdTime.cpp @@ -63,15 +63,18 @@ static int timeRegister(void) // Define EPICS_TS_FORCE_NTPTIME to force use of NTPTime provider bool useNTP = getenv("EPICS_TS_FORCE_NTPTIME") != NULL; - if (!useNTP && - (taskNameToId(sntp_sync_task) != ERROR || - taskNameToId(ntp_daemon) != ERROR)) { - // A VxWorks 6 SNTP/NTP sync task is running - struct timespec clockNow; + if (!useNTP) { + if (taskNameToId(sntp_sync_task) != ERROR || + taskNameToId(ntp_daemon) != ERROR) { + // A VxWorks 6 SNTP/NTP sync task is running + struct timespec clockNow; - useNTP = clock_gettime(CLOCK_REALTIME, &clockNow) != OK || - clockNow.tv_sec < BUILD_TIME; - // Assumes VxWorks and the host OS have the same epoch + useNTP = clock_gettime(CLOCK_REALTIME, &clockNow) != OK || + clockNow.tv_sec < BUILD_TIME; + // Assumes VxWorks and the host OS have the same epoch + } + else + useNTP = 1; } if (useNTP) {