projects
/
darkstat-debian
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pull in darkstat-3.0.718
[darkstat-debian]
/
graph_db.c
diff --git
a/graph_db.c
b/graph_db.c
index
c0875d4
..
4485d45
100644
(file)
--- a/
graph_db.c
+++ b/
graph_db.c
@@
-1,5
+1,5
@@
/* darkstat 3
/* darkstat 3
- * copyright (c) 2006-201
1
Emil Mikulic.
+ * copyright (c) 2006-201
4
Emil Mikulic.
*
* graph_db.c: round robin database for graph data
*
*
* graph_db.c: round robin database for graph data
*
@@
-47,7
+47,7
@@
static struct graph *graph_db[] = {
};
static unsigned int graph_db_size = sizeof(graph_db)/sizeof(*graph_db);
};
static unsigned int graph_db_size = sizeof(graph_db)/sizeof(*graph_db);
-static
long
start_mono, start_real, last_real;
+static
time_t
start_mono, start_real, last_real;
void graph_init(void) {
unsigned int i;
void graph_init(void) {
unsigned int i;
@@
-57,6
+57,7
@@
void graph_init(void) {
}
start_mono = now_mono();
start_real = now_real();
}
start_mono = now_mono();
start_real = now_real();
+ last_real = 0;
graph_reset();
}
graph_reset();
}
@@
-127,6
+128,7
@@
static void rotate(struct graph *g, const unsigned int pos) {
memcpy(g->out, tmp, size);
free(tmp);
memcpy(g->out, tmp, size);
free(tmp);
+ assert(g->num_bars > 0);
assert(pos == ( (g->pos + ofs) % g->num_bars ));
g->pos = pos;
}
assert(pos == ( (g->pos + ofs) % g->num_bars ));
g->pos = pos;
}
@@
-169,7
+171,7
@@
static void graph_resync(const time_t new_real) {
}
void graph_rotate(void) {
}
void graph_rotate(void) {
-
long
t, td;
+
time_t
t, td;
struct tm *tm;
unsigned int i;
struct tm *tm;
unsigned int i;
@@
-287,7
+289,7
@@
struct str *html_front_page(void) {
struct str *buf, *rf;
unsigned int i;
char start_when[100];
struct str *buf, *rf;
unsigned int i;
char start_when[100];
-
long
d_real, d_mono;
+
time_t
d_real, d_mono;
buf = str_make();
html_open(buf, "Graphs", /*path_depth=*/0, /*want_graph_js=*/1);
buf = str_make();
html_open(buf, "Graphs", /*path_depth=*/0, /*want_graph_js=*/1);
@@
-302,7
+304,7
@@
struct str *html_front_page(void) {
str_append(buf, "</span>");
if (abs(d_real - d_mono) > 1)
str_appendf(buf, " (real time is off by %qd sec)",
str_append(buf, "</span>");
if (abs(d_real - d_mono) > 1)
str_appendf(buf, " (real time is off by %qd sec)",
- (
int64_t)d_real - (int64_t
)d_mono);
+ (
qd)d_real - (qd
)d_mono);
if (strftime(start_when, sizeof(start_when),
"%Y-%m-%d %H:%M:%S %Z%z", localtime(&start_real)) != 0)
if (strftime(start_when, sizeof(start_when),
"%Y-%m-%d %H:%M:%S %Z%z", localtime(&start_real)) != 0)
@@
-314,9
+316,10
@@
struct str *html_front_page(void) {
"(<span id=\"pc\">%'u</span> <b>captured,</b> "
"<span id=\"pd\">%'u</span> <b>dropped)</b><br>\n"
"</p>\n",
"(<span id=\"pc\">%'u</span> <b>captured,</b> "
"<span id=\"pd\">%'u</span> <b>dropped)</b><br>\n"
"</p>\n",
- acct_total_bytes,
- acct_total_packets,
- cap_pkts_recv, cap_pkts_drop);
+ (qu)acct_total_bytes,
+ (qu)acct_total_packets,
+ cap_pkts_recv,
+ cap_pkts_drop);
str_append(buf,
"<div id=\"graphs\">\n"
str_append(buf,
"<div id=\"graphs\">\n"
@@
-361,7
+364,10
@@
struct str *xml_graphs(void) {
struct str *buf = str_make(), *rf;
str_appendf(buf, "<graphs tp=\"%qu\" tb=\"%qu\" pc=\"%u\" pd=\"%u\" rf=\"",
struct str *buf = str_make(), *rf;
str_appendf(buf, "<graphs tp=\"%qu\" tb=\"%qu\" pc=\"%u\" pd=\"%u\" rf=\"",
- acct_total_packets, acct_total_bytes, cap_pkts_recv, cap_pkts_drop);
+ (qu)acct_total_packets,
+ (qu)acct_total_bytes,
+ cap_pkts_recv,
+ cap_pkts_drop);
rf = length_of_time(now_real() - start_real);
str_appendstr(buf, rf);
str_free(rf);
rf = length_of_time(now_real() - start_real);
str_appendstr(buf, rf);
str_free(rf);
@@
-376,7
+382,9
@@
struct str *xml_graphs(void) {
j = (j + 1) % g->num_bars;
/* <element pos="" in="" out=""/> */
str_appendf(buf, "<e p=\"%u\" i=\"%qu\" o=\"%qu\"/>\n",
j = (j + 1) % g->num_bars;
/* <element pos="" in="" out=""/> */
str_appendf(buf, "<e p=\"%u\" i=\"%qu\" o=\"%qu\"/>\n",
- g->offset + j, g->in[j], g->out[j]);
+ g->offset + j,
+ (qu)g->in[j],
+ (qu)g->out[j]);
} while (j != g->pos);
str_appendf(buf, "</%s>\n", g->unit);
}
} while (j != g->pos);
str_appendf(buf, "</%s>\n", g->unit);
}