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.
This commit is contained in:
Alex Lin 2019-06-11 15:50:49 -05:00
parent a78fcf1bc9
commit a420418443
2 changed files with 9 additions and 17 deletions

View File

@ -35,7 +35,7 @@ PLATFORM_LIBS += -L$(DMTCP)/dmtcpaware -ldmtcpaware
endif endif
ifneq ($(TPROCTE),) 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 PLATFORM_LIBS += $(TPROCTE)/linux/tsync/lib/libtsync.a $(TPROCTE)/linux/lib/libtpro.a
TRICK_EXCLUDE += :$(TPROCTE) TRICK_EXCLUDE += :$(TPROCTE)
endif endif

View File

@ -7,6 +7,7 @@ PROGRAMMERS:
#include <stdio.h> #include <stdio.h>
#include "tsync.h"
#include "trick/TPROCTEClock.hh" #include "trick/TPROCTEClock.hh"
#include "trick/message_proto.h" #include "trick/message_proto.h"
#include "trick/message_type.h" #include "trick/message_type.h"
@ -67,26 +68,17 @@ Please run ${TRICK_HOME}/configure --with-tpro=<directory holding CTE>, and reco
*/ */
long long Trick::TPROCTEClock::wall_clock_time() { long long Trick::TPROCTEClock::wall_clock_time() {
#ifdef _TPRO_CTE #ifdef _TPRO_CTE
unsigned char rv; TSYNC_HWTimeSecondsObj hwTime;
TPRO_TimeObj tproTime;
long long curr_time ;
/* Get the TPRO/TSAT current time */ /* Send Get Seconds Time message */
rv = TPRO_getTime(pBoard, &tproTime); TSYNC_ERROR err = TSYNC_HW_getTimeSec(pBoard, &hwTime);
/* If unable to get the TPRO/TSAT current time... */ if (err != TSYNC_SUCCESS) {
if (rv != TPRO_SUCCESS) { printf(" Error: %s.\n", tsync_strerror(err));
printf (" Could not retrieve time from '%s'!! [%d]\n", dev_name.c_str(), rv); return 0;
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) ;
} }
return hwTime.time.seconds * 1000000LL + (hwTime.time.ns /1000);
return (curr_time);
#else #else
message_publish(MSG_ERROR, "TPRO CTE card was not enabled at compile time\n"); message_publish(MSG_ERROR, "TPRO CTE card was not enabled at compile time\n");
return 0 ; return 0 ;