Loading Common/Libraries/IRALibrary/include/Definitions.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ #define ABS(X,Y) (X>=Y)?X-Y:Y-X #define ABS(X,Y) (X>=Y)?X-Y:Y-X #define LIGHTSPEED_MS 299792458.0 #define LIGHTSPEED_MS 299792458.0 #define ACSTIME2UNIXEPOCHOFFSET 122192928000000000 /** /** * Creates an exception * Creates an exception Loading Common/Libraries/IRALibrary/include/IRATools.h +18 −0 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ /* Andrea Orlati(aorlati@ira.inaf.it) 12/08/2015 Function to check if a file exists or not */ /* Andrea Orlati(aorlati@ira.inaf.it) 12/08/2015 Function to check if a file exists or not */ /* Andrea Orlati(aorlati@ira.inaf.it) 19/11/2015 Function timeToStrExtended was added */ /* Andrea Orlati(aorlati@ira.inaf.it) 19/11/2015 Function timeToStrExtended was added */ /* Andrea Orlati(aorlati@ira.inaf.it) 12/01/2016 reviewed the function skyFrequency in order to address also lower side band during down conversion */ /* Andrea Orlati(aorlati@ira.inaf.it) 12/01/2016 reviewed the function skyFrequency in order to address also lower side band during down conversion */ /* Giuseppe Carboni (giuseppe.carboni@inaf.it) 07/12/2021 added the getUNIXEpoch, ACSTime2UNIXEpoch and UNIXEpoch2ACSTime functions */ #include <time.h> #include <time.h> #include <sys/time.h> #include <sys/time.h> Loading Loading @@ -136,6 +137,23 @@ public: * @return the ACS::Time variable containing the current time * @return the ACS::Time variable containing the current time */ */ static ACS::Time getACSTime(); static ACS::Time getACSTime(); /** * Call this function to get the current UNIX epoch * @return a double containing the current UNIX epoch */ static double getUNIXEpoch(); /** * Call this function in order to get the UNIX Epoch of the given ACS::Time * @param acs_time the given ACS::Time * @return a double containing the UNIX epoch of the given ACS::Time */ static double ACSTime2UNIXEpoch(ACS::Time acs_time); /** * Call this function in order to get the ACS::Time of the given UNIX Epoch * @param unix_epoch the given UNIX Epoch (double) * @return a ACS::Time object of the given UNIX Epoch */ static ACS::Time UNIXEpoch2ACSTime(double unix_epoch); /** /** * This function performs the copy of an epoch * This function performs the copy of an epoch * @param dst destination epoch * @param dst destination epoch Loading Common/Libraries/IRALibrary/src/IRATools.cpp +18 −3 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,21 @@ ACS::Time CIRATools::getACSTime() return now.value().value; return now.value().value; } } double CIRATools::getUNIXEpoch() { return CIRATools::ACSTime2UNIXEpoch(CIRATools::getACSTime()); } double CIRATools::ACSTime2UNIXEpoch(ACS::Time acs_time) { return double(acs_time - ACSTIME2UNIXEPOCHOFFSET) / 10000000; } ACS::Time CIRATools::UNIXEpoch2ACSTime(double unix_epoch) { return ACS::Time(long(unix_epoch * 10000000) + ACSTIME2UNIXEPOCHOFFSET); } void CIRATools::timeCopy(TIMEVALUE& dst,const TIMEVALUE& src) void CIRATools::timeCopy(TIMEVALUE& dst,const TIMEVALUE& src) { { // EpochHelper.value() should have to have the 'const' qualifiers....that would result in a warning // EpochHelper.value() should have to have the 'const' qualifiers....that would result in a warning Loading Loading
Common/Libraries/IRALibrary/include/Definitions.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ #define ABS(X,Y) (X>=Y)?X-Y:Y-X #define ABS(X,Y) (X>=Y)?X-Y:Y-X #define LIGHTSPEED_MS 299792458.0 #define LIGHTSPEED_MS 299792458.0 #define ACSTIME2UNIXEPOCHOFFSET 122192928000000000 /** /** * Creates an exception * Creates an exception Loading
Common/Libraries/IRALibrary/include/IRATools.h +18 −0 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ /* Andrea Orlati(aorlati@ira.inaf.it) 12/08/2015 Function to check if a file exists or not */ /* Andrea Orlati(aorlati@ira.inaf.it) 12/08/2015 Function to check if a file exists or not */ /* Andrea Orlati(aorlati@ira.inaf.it) 19/11/2015 Function timeToStrExtended was added */ /* Andrea Orlati(aorlati@ira.inaf.it) 19/11/2015 Function timeToStrExtended was added */ /* Andrea Orlati(aorlati@ira.inaf.it) 12/01/2016 reviewed the function skyFrequency in order to address also lower side band during down conversion */ /* Andrea Orlati(aorlati@ira.inaf.it) 12/01/2016 reviewed the function skyFrequency in order to address also lower side band during down conversion */ /* Giuseppe Carboni (giuseppe.carboni@inaf.it) 07/12/2021 added the getUNIXEpoch, ACSTime2UNIXEpoch and UNIXEpoch2ACSTime functions */ #include <time.h> #include <time.h> #include <sys/time.h> #include <sys/time.h> Loading Loading @@ -136,6 +137,23 @@ public: * @return the ACS::Time variable containing the current time * @return the ACS::Time variable containing the current time */ */ static ACS::Time getACSTime(); static ACS::Time getACSTime(); /** * Call this function to get the current UNIX epoch * @return a double containing the current UNIX epoch */ static double getUNIXEpoch(); /** * Call this function in order to get the UNIX Epoch of the given ACS::Time * @param acs_time the given ACS::Time * @return a double containing the UNIX epoch of the given ACS::Time */ static double ACSTime2UNIXEpoch(ACS::Time acs_time); /** * Call this function in order to get the ACS::Time of the given UNIX Epoch * @param unix_epoch the given UNIX Epoch (double) * @return a ACS::Time object of the given UNIX Epoch */ static ACS::Time UNIXEpoch2ACSTime(double unix_epoch); /** /** * This function performs the copy of an epoch * This function performs the copy of an epoch * @param dst destination epoch * @param dst destination epoch Loading
Common/Libraries/IRALibrary/src/IRATools.cpp +18 −3 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,21 @@ ACS::Time CIRATools::getACSTime() return now.value().value; return now.value().value; } } double CIRATools::getUNIXEpoch() { return CIRATools::ACSTime2UNIXEpoch(CIRATools::getACSTime()); } double CIRATools::ACSTime2UNIXEpoch(ACS::Time acs_time) { return double(acs_time - ACSTIME2UNIXEPOCHOFFSET) / 10000000; } ACS::Time CIRATools::UNIXEpoch2ACSTime(double unix_epoch) { return ACS::Time(long(unix_epoch * 10000000) + ACSTIME2UNIXEPOCHOFFSET); } void CIRATools::timeCopy(TIMEVALUE& dst,const TIMEVALUE& src) void CIRATools::timeCopy(TIMEVALUE& dst,const TIMEVALUE& src) { { // EpochHelper.value() should have to have the 'const' qualifiers....that would result in a warning // EpochHelper.value() should have to have the 'const' qualifiers....that would result in a warning Loading