We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug There are multiple implementations of GPS and UNIX time conversion in Apollo. The first is in https://github.com/ApolloAuto/apollo/blob/master/modules/common/util/time_util.h, the second is in https://github.com/ApolloAuto/apollo/blob/master/modules/drivers/gnss/util/time_conversion.h, the third is in https://github.com/ApolloAuto/apollo/blob/master/cyber/common/time_conversion.h, the last is in https://github.com/ApolloAuto/apollo/blob/master/modules/localization/msf/common/util/time_conversion.h.
To Reproduce Steps to reproduce the behavior: I compared the first three implementations with GPS time 1001696182.543048
1001696182.543048
#include <iostream> #include "time_util.h" // https://github.com/ApolloAuto/apollo/blob/master/modules/common/util/time_util.h #include "time_conversion.h" // https://github.com/ApolloAuto/apollo/blob/master/modules/drivers/gnss/util/time_conversion.h #include "time_conversion_new.h" // https://github.com/ApolloAuto/apollo/blob/master/cyber/common/time_conversion.h int main() { double gps_time = 1001696182.543048; // https://github.com/ApolloAuto/apollo/blob/master/modules/common/util/time_util.h double unix_time = TimeUtil::Gps2unix(gps_time); std::cout << "TimeUtil::Gps2unix\n\tGPS time: " << GLOG_TIMESTAMP(gps_time) << " -> Unix time: " << GLOG_TIMESTAMP(unix_time) << std::endl; // https://github.com/ApolloAuto/apollo/blob/master/modules/drivers/gnss/util/time_conversion.h unix_time = gps2unix(gps_time); std::cout << "gps2unix\n\tGPS time: " << GLOG_TIMESTAMP(gps_time) << " -> Unix time: " << GLOG_TIMESTAMP(unix_time) << std::endl; // https://github.com/ApolloAuto/apollo/blob/master/cyber/common/time_conversion.h unix_time = GpsToUnixSeconds(gps_time); std::cout << "GpsToUnixSeconds\n\tGPS time: " << GLOG_TIMESTAMP(gps_time) << " -> Unix time: " << GLOG_TIMESTAMP(unix_time) << std::endl; return 0; }
There is a 2 seconds diff, between time_util.h and time_conversion.h, as shown below
time_util.h
time_conversion.h
(msfloc) bo@apollo:~/projects/time_conversion$ ./a.out TimeUtil::Gps2unix GPS time: 1001696182.543048024 -> Unix time: 1317660965.543047905 gps2unix GPS time: 1001696182.543048024 -> Unix time: 1317660967.543047905 GpsToUnixSeconds GPS time: 1001696182.543048024 -> Unix time: 1317660967.543047905
Which one is correct?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
There are multiple implementations of GPS and UNIX time conversion in Apollo. The first is in https://github.com/ApolloAuto/apollo/blob/master/modules/common/util/time_util.h, the second is in https://github.com/ApolloAuto/apollo/blob/master/modules/drivers/gnss/util/time_conversion.h, the third is in https://github.com/ApolloAuto/apollo/blob/master/cyber/common/time_conversion.h, the last is in https://github.com/ApolloAuto/apollo/blob/master/modules/localization/msf/common/util/time_conversion.h.
To Reproduce
Steps to reproduce the behavior:
I compared the first three implementations with GPS time
1001696182.543048
There is a 2 seconds diff, between
time_util.h
andtime_conversion.h
, as shown belowWhich one is correct?
The text was updated successfully, but these errors were encountered: