Skip to content
Snippets Groups Projects
Commit fb368c32 authored by Janusz Dziedzic's avatar Janusz Dziedzic
Browse files

opclass use timestamp_* util functions

parent b30bf582
No related branches found
No related tags found
No related merge requests found
Pipeline #51261 passed
...@@ -1200,13 +1200,10 @@ void cntlr_radio_cur_opclass_dump(struct netif_radio *radio) ...@@ -1200,13 +1200,10 @@ void cntlr_radio_cur_opclass_dump(struct netif_radio *radio)
static bool cntlr_radio_opclass_expired(struct netif_radio *radio) static bool cntlr_radio_opclass_expired(struct netif_radio *radio)
{ {
time_t age;
if (!radio->opclass.entry_num) if (!radio->opclass.entry_num)
return true; return true;
age = time(NULL) - radio->opclass.entry_time; if (timestamp_expired(&radio->opclass.entry_time, 120000))
if (((unsigned int) age) > 120)
return true; return true;
return false; return false;
......
...@@ -438,7 +438,7 @@ static void cntlr_status_add_opclass(struct blob_buf *bb, struct opclass *opclas ...@@ -438,7 +438,7 @@ static void cntlr_status_add_opclass(struct blob_buf *bb, struct opclass *opclas
/* Add age */ /* Add age */
snprintf(age, sizeof(age), "%s_age", name); snprintf(age, sizeof(age), "%s_age", name);
blobmsg_add_u32(bb, age, (uint32_t) (time(NULL) - opclass->entry_time)); blobmsg_add_u32(bb, age, timestamp_elapsed_sec(&opclass->entry_time));
a = blobmsg_open_array(bb, name); a = blobmsg_open_array(bb, name);
for (j = 0; j < opclass->entry_num; j++) { for (j = 0; j < opclass->entry_num; j++) {
......
...@@ -34,7 +34,7 @@ struct opclass_entry *opclass_new_entry(struct opclass *opclass) ...@@ -34,7 +34,7 @@ struct opclass_entry *opclass_new_entry(struct opclass *opclass)
entry = &opclass->entry[opclass->entry_num]; entry = &opclass->entry[opclass->entry_num];
opclass->entry_num++; opclass->entry_num++;
opclass->entry_time = time(NULL); timestamp_update(&opclass->entry_time);
return entry; return entry;
} }
......
...@@ -28,7 +28,7 @@ struct opclass_entry { ...@@ -28,7 +28,7 @@ struct opclass_entry {
}; };
struct opclass { struct opclass {
time_t entry_time; struct timespec entry_time;
int entry_num; int entry_num;
struct opclass_entry entry[64]; struct opclass_entry entry[64];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment