Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cs
ds
alarm-handler
Commits
f537d1d9
Commit
f537d1d9
authored
Dec 22, 2021
by
Graziano Scalamera
Browse files
Add timestamp in notification
parent
9f97baf0
Pipeline
#1658
failed with stages
in 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/AlarmHandler.cpp
View file @
f537d1d9
...
...
@@ -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
{
...
...
src/alarm_table.cpp
View file @
f537d1d9
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment