From 518a07d05b09b0cebe0d68628757266ce5facc4c Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 14:29:47 +0100 Subject: [PATCH 1/2] removed duplicate code --- src/fsfw/globalfunctions/TimeSystems.h | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/fsfw/globalfunctions/TimeSystems.h diff --git a/src/fsfw/globalfunctions/TimeSystems.h b/src/fsfw/globalfunctions/TimeSystems.h deleted file mode 100644 index 533dc5cb..00000000 --- a/src/fsfw/globalfunctions/TimeSystems.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef FSFW_SRC_FSFW_GLOBALFUNCTIONS_TIMESYSTEMS_H_ -#define FSFW_SRC_FSFW_GLOBALFUNCTIONS_TIMESYSTEMS_H_ - -#ifdef PLATFORM_WIN -#include -#else -#include -#endif - -class TimeSystems { - public: - virtual ~TimeSystems() {} - - static double convertUnixToJD2000(timeval time) { - return ((time.tv_sec + time.tv_usec * 1e-6) / 86400.0) + 2440587.5 - 2451545; - } -}; - -#endif /* FSFW_SRC_FSFW_GLOBALFUNCTIONS_TIMESYSTEMS_H_ */ From 26730702045f24ca23e15d3db1148ab1f3ce47d9 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 6 Mar 2024 09:41:02 +0100 Subject: [PATCH 2/2] actually do something with this rtval --- src/fsfw/coordinates/CoordinateTransformations.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fsfw/coordinates/CoordinateTransformations.cpp b/src/fsfw/coordinates/CoordinateTransformations.cpp index a983d0a2..60dc4301 100644 --- a/src/fsfw/coordinates/CoordinateTransformations.cpp +++ b/src/fsfw/coordinates/CoordinateTransformations.cpp @@ -7,6 +7,7 @@ #include "fsfw/globalfunctions/math/MatrixOperations.h" #include "fsfw/globalfunctions/math/VectorOperations.h" #include "fsfw/globalfunctions/sign.h" +#include "fsfw/serviceinterface.h" void CoordinateTransformations::positionEcfToEci(const double* ecfPosition, double* eciPosition, timeval* timeUTC) { @@ -98,7 +99,14 @@ void CoordinateTransformations::ecfToEci(const double* ecfCoordinates, double* e double CoordinateTransformations::getJuleanCenturiesTT(timeval timeUTC) { timeval timeTT; - Clock::convertUTCToTT(timeUTC, &timeTT); + ReturnValue_t result = Clock::convertUTCToTT(timeUTC, &timeTT); + if (result != returnvalue::OK) { + // i think it is better to continue here than to abort + timeTT = timeUTC; + sif::error << "CoordinateTransformations::Conversion from UTC to TT failed. Continuing " + "calculations with UTC." + << std::endl; + } double jD2000TT; Clock::convertTimevalToJD2000(timeTT, &jD2000TT);