8000 replay: fix potential timestamp parsing error in Route::load by deanlee · Pull Request #35117 · commaai/openpilot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

replay: fix potential timestamp parsing error in Route::load #35117

New issue

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

Merged
merged 1 commit into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tools/replay/route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ bool Route::load() {
return false;
}

// Parse the timestamp from the route identifier (only applicable for old route formats).
struct tm tm_time = {0};
strptime(route_.timestamp.c_str(), "%Y-%m-%d--%H-%M-%S", &tm_time);
date_time_ = mktime(&tm_time);
if (strptime(route_.timestamp.c_str(), "%Y-%m-%d--%H-%M-%S", &tm_time)) {
date_time_ = mktime(&tm_time);
}

bool ret = data_dir_.empty() ? loadFromServer() : loadFromLocal();
if (ret) {
Expand Down
2 changes: 1 addition & 1 deletion tools/replay/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Route {
RouteIdentifier route_ = {};
std::string data_dir_;
std::map<int, SegmentFile> segments_;
std::time_t date_time_;
std::time_t date_time_ = 0;
RouteLoadError err_ = RouteLoadError::None;
};

Expand Down
0