diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-05-24 01:45:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-05-24 01:45:54 +0200 |
commit | 871d7de47c13ee6cd78b8eefdf9128be3c740ac0 (patch) | |
tree | c92b146f086cdf7a58145e4e744133e645f8c8e0 /src/logger.c | |
parent | 4288f619215e3dda0b75113d78e4fb7ba219ed58 (diff) |
timer: fully implement timer units
Diffstat (limited to 'src/logger.c')
-rw-r--r-- | src/logger.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/logger.c b/src/logger.c index 2e036dd77b..5c7e4ee42b 100644 --- a/src/logger.c +++ b/src/logger.c @@ -89,7 +89,7 @@ struct Stream { LIST_FIELDS(Stream, stream); }; -static int stream_log(Stream *s, char *p, usec_t timestamp) { +static int stream_log(Stream *s, char *p, usec_t ts) { char header_priority[16], header_time[64], header_pid[16]; struct iovec iovec[5]; @@ -134,7 +134,7 @@ static int stream_log(Stream *s, char *p, usec_t timestamp) { time_t t; struct tm *tm; - t = (time_t) (timestamp / USEC_PER_SEC); + t = (time_t) (ts / USEC_PER_SEC); if (!(tm = localtime(&t))) return -EINVAL; @@ -177,7 +177,7 @@ static int stream_log(Stream *s, char *p, usec_t timestamp) { return 0; } -static int stream_line(Stream *s, char *p, usec_t timestamp) { +static int stream_line(Stream *s, char *p, usec_t ts) { int r; assert(s); @@ -236,13 +236,13 @@ static int stream_line(Stream *s, char *p, usec_t timestamp) { return 0; case STREAM_RUNNING: - return stream_log(s, p, timestamp); + return stream_log(s, p, ts); } assert_not_reached("Unknown stream state"); } -static int stream_scan(Stream *s, usec_t timestamp) { +static int stream_scan(Stream *s, usec_t ts) { char *p; size_t remaining; int r = 0; @@ -259,7 +259,7 @@ static int stream_scan(Stream *s, usec_t timestamp) { *newline = 0; - if ((r = stream_line(s, p, timestamp)) >= 0) { + if ((r = stream_line(s, p, ts)) >= 0) { remaining -= newline-p+1; p = newline+1; } @@ -273,7 +273,7 @@ static int stream_scan(Stream *s, usec_t timestamp) { return r; } -static int stream_process(Stream *s, usec_t timestamp) { +static int stream_process(Stream *s, usec_t ts) { ssize_t l; int r; assert(s); @@ -292,7 +292,7 @@ static int stream_process(Stream *s, usec_t timestamp) { return 0; s->length += l; - r = stream_scan(s, timestamp); + r = stream_scan(s, ts); if (r < 0) return r; @@ -501,10 +501,10 @@ static int process_event(Server *s, struct epoll_event *ev) { } } else { - usec_t timestamp; + usec_t ts; Stream *stream = ev->data.ptr; - timestamp = now(CLOCK_REALTIME); + ts = now(CLOCK_REALTIME); if (!(ev->events & EPOLLIN)) { log_info("Got invalid event from epoll. (2)"); @@ -512,7 +512,7 @@ static int process_event(Server *s, struct epoll_event *ev) { return 0; } - if ((r = stream_process(stream, timestamp)) <= 0) { + if ((r = stream_process(stream, ts)) <= 0) { if (r < 0) log_info("Got error on stream: %s", strerror(-r)); |