Quellcode durchsuchen

added timestamp to status

tags/v1.1.0
root vor 5 Jahren
Ursprung
Commit
c73471920b
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. 1
    1
      src/dp_accounting.c
  2. 5
    5
      src/dp_events.c

+ 1
- 1
src/dp_accounting.c Datei anzeigen

@@ -57,7 +57,7 @@ void dp_accounting_cleanup(dp_conf *conf) {
// is it time to cleanup the list?
// cleanup every conf->interval seconds
if ( dp_accountingtime + conf->interval < time(NULL) ) {
if ( conf->debug ) printf("cleanup interval\n");
if ( conf->debug ) printf("cleanup AC\n");
dp_accountingtime = time(NULL);
HASH_ITER(hh, accountings, ac, actmp) {
HASH_DEL(accountings, ac);

+ 5
- 5
src/dp_events.c Datei anzeigen

@@ -37,22 +37,22 @@ void *dp_events(void *data) {
while(1) {
time_t now = time(NULL);

if ( last_blacklist + DP_BL_CLEAN_INT >= now ) {
if ( last_blacklist + DP_BL_CLEAN_INT <= now ) {
dp_blacklist_cleanup(conf);
last_blacklist=now;
}

if ( last_accounting + DP_AC_CLEAN_INT >= now ) {
if ( last_accounting + DP_AC_CLEAN_INT <= now ) {
dp_accounting_cleanup(conf);
last_accounting=now;
}

if ( last_stats + conf->stats_interval >= now ) {
if ( last_stats + conf->stats_interval <= now ) {
dp_events_stats(conf);
last_stats=now;
}

usleep(100000); /* 100ms */
usleep(500000); /* 100ms */
}

return NULL;
@@ -117,7 +117,7 @@ void dp_events_stats(dp_conf *conf) {
}
}

fprintf(fh, "] }\n");
fprintf(fh, "], \"timestamp\": %i }\n", (int)time(NULL));

fclose(fh);


Laden…
Abbrechen
Speichern