lib_log: remember timestamp of last logging operation

This commit is contained in:
Thomas Schoebel-Theuer 2012-12-13 09:34:11 +01:00 committed by Thomas Schoebel-Theuer
parent 7b998de219
commit e7ec75d497
2 changed files with 6 additions and 0 deletions

View File

@ -152,6 +152,7 @@ void log_flush(struct log_status *logst)
}
mref->ref_len = logst->offset;
logst->log_pos += logst->offset;
memcpy(&logst->log_pos_stamp, &logst->tmp_pos_stamp, sizeof(logst->log_pos_stamp));
cb_info = logst->private;
logst->private = NULL;
@ -272,6 +273,9 @@ void *log_reserve(struct log_status *logst, struct log_header *lh)
DATA_PUT(data, offset, lh->l_code);
DATA_PUT(data, offset, lh->l_extra);
// remember the last timestamp
memcpy(&logst->tmp_pos_stamp, &lh->l_stamp, sizeof(logst->tmp_pos_stamp));
logst->payload_offset = offset;
logst->payload_len = lh->l_len;

View File

@ -98,7 +98,9 @@ struct log_status {
atomic_t mref_flying;
int count;
loff_t log_pos;
struct timespec log_pos_stamp;
// internal
struct timespec tmp_pos_stamp;
struct mars_input *input;
struct mars_brick *brick;
struct mars_info info;