diff --git a/src/main.c b/src/main.c index 2910fdc..84c6c77 100644 --- a/src/main.c +++ b/src/main.c @@ -48,6 +48,8 @@ static int config_handler(void* user, const char* section, const char* name, con web_refresh = result > 1 ? result : 1; } else if (strcmp(name, "status_refresh") == 0) { status_refresh = atoi(value); + } else if (strcmp(name, "retention") == 0) { + retention = atoi(value); } else { printf("Unknown configuration entry \'%s\'\n", name); } diff --git a/src/main.h b/src/main.h index 0c0f7d7..ccb6afc 100644 --- a/src/main.h +++ b/src/main.h @@ -29,6 +29,7 @@ char* daemon_banner = ""; uint32_t global_backoff = 5; uint32_t web_refresh = 30; uint32_t status_refresh = 30; +uint32_t retention = 86400; int get_asset(char** buffer, const char* path, size_t* size) { *size = 0; @@ -211,7 +212,7 @@ mxml_node_t* generate_index() { for (; !iterator_equals(&count_it, &peroid_end); iterator_increment(&count_it)) { struct StatusPeroid* peroid = *(struct StatusPeroid**)iterator_get(&count_it); if (earliest_time == 0) earliest_time = peroid->time; - else if (peroid->time <= (now - 86400000000)) { + else if (peroid->time <= (now - (long)retension * 1000000)) { earliest_time = peroid->time; } else col_count++; }