Commit f254a8bb authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Fix problem with showing HH:MM:60 as rounded time

parent 43f7d967
......@@ -149,10 +149,10 @@ int data_obs::set_time(int year, int mon, int day, int hour, int min, int sec,
int data_obs::set_time(struct timespec* time) {
// Initialize tm
//TODO Make t a class-variable to avoid repeated allocation
struct tm t = {0};
//TODO Make t a class-variable to avoid repeated allocation
struct tm t = {0};
// Use gmtime_r for thread-safety
// Use gmtime_r for thread-safety
gmtime_r(&time->tv_sec,&t);
year = t.tm_year + 1900;
......@@ -295,6 +295,7 @@ std::string data_obs::get_time(std::string formatstr, bool rounded) const{
if (rounded && data_obs::msec >= 500e6){
tm.tm_sec += 1;
mktime(&tm);
}
// TODO This may be slow, possibly better to use sprintf and fixed
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment