diff --git a/src/AlarmHandler.cpp b/src/AlarmHandler.cpp index 3387c7dcdf121991da4e613cc34108501d8baf17..0ce37d8d0fed5973464f95951b47e7a719e9d567 100644 --- a/src/AlarmHandler.cpp +++ b/src/AlarmHandler.cpp @@ -3063,6 +3063,17 @@ Tango::DevVarStringArray *AlarmHandler::get_alarm_info(const Tango::DevVarString complete.push_back(KEY(ATTR_VALUES_KEY)+it->second.attr_values); } + tm time_tm; + time_t time_sec= it->second.ts.tv_sec; + //gmtime_r(&time_sec,&time_tm); //-> UTC + localtime_r(&time_sec,&time_tm); + char time_buf[64]; + strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", &time_tm); + ostringstream time_s; + time_s << time_buf << "." << it->second.ts.tv_usec; + info.insert(make_pair(ALARM_TIME_KEY,time_s.str())); + complete.push_back(KEY(ALARM_TIME_KEY)+time_s.str()); + ostringstream tmp_qual; try { diff --git a/src/alarm_table.cpp b/src/alarm_table.cpp index a43e1e0f2e4e8de57a6387954d2d68491ce3f8f5..1d7896238918effc0b8603aa1c167bac5066159b 100644 --- a/src/alarm_table.cpp +++ b/src/alarm_table.cpp @@ -420,7 +420,13 @@ bool alarm_table::update(const string& alm_name, Tango::TimeVal ts, formula_res_ replace(tmp_attr_val.begin(), tmp_attr_val.end(), ';' , ','); string tmp_msg = msg; replace(tmp_msg.begin(), tmp_msg.end(), ';' , ','); - tmp << "name=" << alm_name << ";groups=" << grp << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<formula<<";url="<<found->second.url; + tm time_tm; + time_t time_sec= found->second.ts.tv_sec; + //gmtime_r(&time_sec,&time_tm); //-> UTC + localtime_r(&time_sec,&time_tm); + char time_buf[64]; + strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", &time_tm); + tmp << "name=" << alm_name << ";groups=" << grp << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<formula<<";time="<<time_buf << "." << found->second.ts.tv_usec<<";url="<<found->second.url; cmd_t arg; arg.cmd_id = CMD_COMMAND; arg.dp_add = (long)found->second.dp_a; @@ -466,7 +472,13 @@ bool alarm_table::update(const string& alm_name, Tango::TimeVal ts, formula_res_ replace(tmp_attr_val.begin(), tmp_attr_val.end(), ';' , ','); string tmp_msg = msg; replace(tmp_msg.begin(), tmp_msg.end(), ';' , ','); - tmp << "name=" << alm_name << ";groups=" << grp << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<formula; + tm time_tm; + time_t time_sec= found->second.ts.tv_sec; + //gmtime_r(&time_sec,&time_tm); //-> UTC + localtime_r(&time_sec,&time_tm); + char time_buf[64]; + strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", &time_tm); + tmp << "name=" << alm_name << ";groups=" << grp << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<formula<<";time="<<time_buf << "." << found->second.ts.tv_usec; cmd_t arg; arg.cmd_id = CMD_COMMAND; arg.dp_add = (long)found->second.dp_n; @@ -653,7 +665,13 @@ bool alarm_table::timer_update() replace(tmp_attr_val.begin(), tmp_attr_val.end(), ';' , ','); string tmp_msg = i->second.msg; replace(tmp_msg.begin(), tmp_msg.end(), ';' , ','); - tmp << "name=" << i->second.name << ";groups=" << i->second.grp2str() << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<i->second.formula<<";url="<<i->second.url; + tm time_tm; + time_t time_sec= i->second.ts.tv_sec; + //gmtime_r(&time_sec,&time_tm); //-> UTC + localtime_r(&time_sec,&time_tm); + char time_buf[64]; + strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", &time_tm); + tmp << "name=" << i->second.name << ";groups=" << i->second.grp2str() << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<i->second.formula<<";time="<<time_buf << "." << i->second.ts.tv_usec<<";url="<<i->second.url; cmd_t arg; arg.cmd_id = CMD_COMMAND; arg.dp_add = (long)i->second.dp_a; @@ -699,7 +717,13 @@ bool alarm_table::timer_update() replace(tmp_attr_val.begin(), tmp_attr_val.end(), ';' , ','); string tmp_msg = i->second.msg; replace(tmp_msg.begin(), tmp_msg.end(), ';' , ','); - tmp << "name=" << i->second.name << ";groups=" << i->second.grp2str() << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<i->second.formula<<";url="<<i->second.url; + tm time_tm; + time_t time_sec= i->second.ts.tv_sec; + //gmtime_r(&time_sec,&time_tm); //-> UTC + localtime_r(&time_sec,&time_tm); + char time_buf[64]; + strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", &time_tm); + tmp << "name=" << i->second.name << ";groups=" << i->second.grp2str() << ";msg="<<tmp_msg<<";values="<<tmp_attr_val<<";formula="<<i->second.formula<<";time="<<time_buf << "." << i->second.ts.tv_usec<<";url="<<i->second.url; cmd_t arg; arg.cmd_id = CMD_COMMAND; arg.dp_add = (long)i->second.dp_n;