* imc_channel, imc_raw: optimize with pass by reference

* imc_object: asc_time, localtime: make threadsafe
* imc_datatype: satisfy 'rule of two'
* python: remove all unused imports
This commit is contained in:
2021-05-05 13:28:11 +02:00
parent 72378877ec
commit 83922c343f
9 changed files with 27 additions and 17 deletions

View File

@@ -501,16 +501,16 @@ namespace imc
second_ = std::stod( get_parameter(buffer,&parameters[7]) );
time_t rawtime;
struct tm* ts;
struct tm ts;
time(&rawtime);
ts = localtime(&rawtime);
ts->tm_mday = day_;
ts->tm_mon = month_-1;
ts->tm_year = year_-1900;
ts->tm_hour = hour_;
ts->tm_min = minute_;
ts->tm_sec = (int)second_;
timestamp_ = asctime(ts);
localtime_r(&rawtime,&ts);
ts.tm_mday = day_;
ts.tm_mon = month_-1;
ts.tm_year = year_-1900;
ts.tm_hour = hour_;
ts.tm_min = minute_;
ts.tm_sec = (int)second_;
asctime_r(&ts,&timestamp_[0]);
// timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_)
// + std::string("-") + std::to_string(day_)
// + std::string("T") + std::to_string(hour_)