We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 54f7c04 + 762fefc commit 934e8d3Copy full SHA for 934e8d3
1 file changed
source/databaseConnection.cpp
@@ -61,7 +61,11 @@ void DatabaseConnection::printResults(const std::vector<PriceData>& results) con
61
for (const auto& data : results) {
62
// Convert timestamp back to string for display
63
auto time_t = std::chrono::system_clock::to_time_t(data.timestamp);
64
- auto tm = *std::localtime(&time_t);
+ struct tm tm = {};
65
+ if (localtime_r(&time_t, &tm) == nullptr) {
66
+ std::cerr << "Error: failed to convert timestamp" << std::endl;
67
+ continue;
68
+ }
69
std::stringstream ss;
70
ss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
71
0 commit comments