From a420418443c60ffc6f9e3c77c2c46b394a3b6c5a Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 11 Jun 2019 15:50:49 -0500 Subject: [PATCH] TPROCTE_HOME Being Used In Place Of TPRO_HOME #778 Changed the Tsync routing from using the old TPro API to the new Tsync API. --- share/trick/makefiles/config_Linux.mk | 2 +- .../sim_services/Clock/TPROCTEClock.cpp | 24 +++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/share/trick/makefiles/config_Linux.mk b/share/trick/makefiles/config_Linux.mk index aab179ba..5d17e58a 100644 --- a/share/trick/makefiles/config_Linux.mk +++ b/share/trick/makefiles/config_Linux.mk @@ -35,7 +35,7 @@ PLATFORM_LIBS += -L$(DMTCP)/dmtcpaware -ldmtcpaware endif ifneq ($(TPROCTE),) -TRICK_ADDITIONAL_CXXFLAGS += -D_TPRO_CTE -I$(TPROCTE)/linux/h -I$(TPROCTE)/common/h +TRICK_ADDITIONAL_CXXFLAGS += -D_TPRO_CTE -I$(TPROCTE)/linux/h -I$(TPROCTE)/linux/tsync/h -I$(TPROCTE)/common/h -I$(TPROCTE)/common/tsync/h PLATFORM_LIBS += $(TPROCTE)/linux/tsync/lib/libtsync.a $(TPROCTE)/linux/lib/libtpro.a TRICK_EXCLUDE += :$(TPROCTE) endif diff --git a/trick_source/sim_services/Clock/TPROCTEClock.cpp b/trick_source/sim_services/Clock/TPROCTEClock.cpp index c90f6380..1d5d0f2d 100644 --- a/trick_source/sim_services/Clock/TPROCTEClock.cpp +++ b/trick_source/sim_services/Clock/TPROCTEClock.cpp @@ -7,6 +7,7 @@ PROGRAMMERS: #include +#include "tsync.h" #include "trick/TPROCTEClock.hh" #include "trick/message_proto.h" #include "trick/message_type.h" @@ -67,26 +68,17 @@ Please run ${TRICK_HOME}/configure --with-tpro=, and reco */ long long Trick::TPROCTEClock::wall_clock_time() { #ifdef _TPRO_CTE - unsigned char rv; - TPRO_TimeObj tproTime; - long long curr_time ; + TSYNC_HWTimeSecondsObj hwTime; - /* Get the TPRO/TSAT current time */ - rv = TPRO_getTime(pBoard, &tproTime); + /* Send Get Seconds Time message */ + TSYNC_ERROR err = TSYNC_HW_getTimeSec(pBoard, &hwTime); - /* If unable to get the TPRO/TSAT current time... */ - if (rv != TPRO_SUCCESS) { - printf (" Could not retrieve time from '%s'!! [%d]\n", dev_name.c_str(), rv); - return 0 ; - } else { - curr_time = (long long)(tproTime.days * 86400LL * 1000000LL) ; - curr_time += (long long)(tproTime.hours * 3600LL * 1000000LL) ; - curr_time += (long long)(tproTime.minutes * 60LL * 1000000LL) ; - curr_time += (long long)(tproTime.seconds * 1000000LL) ; - curr_time += (long long)((tproTime.secsDouble - tproTime.seconds) * 1000000LL) ; + if (err != TSYNC_SUCCESS) { + printf(" Error: %s.\n", tsync_strerror(err)); + return 0; } + return hwTime.time.seconds * 1000000LL + (hwTime.time.ns /1000); - return (curr_time); #else message_publish(MSG_ERROR, "TPRO CTE card was not enabled at compile time\n"); return 0 ;