From: <mar...@us...> - 2008-09-23 21:00:01
|
Revision: 1406 http://navit.svn.sourceforge.net/navit/?rev=1406&view=rev Author: martin-s Date: 2008-09-23 20:59:58 +0000 (Tue, 23 Sep 2008) Log Message: ----------- Fix:core:Fixed various logging bugs Modified Paths: -------------- trunk/navit/navit/log.c Modified: trunk/navit/navit/log.c =================================================================== --- trunk/navit/navit/log.c 2008-09-23 20:58:32 UTC (rev 1405) +++ trunk/navit/navit/log.c 2008-09-23 20:59:58 UTC (rev 1406) @@ -85,6 +85,12 @@ } static void +log_set_last_flush(struct log *this_) +{ + gettimeofday(&this_->last_flush, NULL); +} + +static void log_open(struct log *this_) { char *mode; @@ -102,7 +108,7 @@ if (!this_->overwrite) fseek(this_->f, 0, SEEK_END); this_->empty = !ftell(this_->f); - gettimeofday(&this_->last_flush, NULL); + log_set_last_flush(this_); } static void @@ -147,7 +153,7 @@ g_free(this_->data.data); this_->data.data=NULL; this_->data.max_len=this_->data.len=0; - gettimeofday(&this_->last_flush, NULL); + log_set_last_flush(this_); } static int @@ -185,7 +191,7 @@ gettimeofday(&tv, NULL); delta=(tv.tv_sec-this_->last_flush.tv_sec)*1000+(tv.tv_usec-this_->last_flush.tv_usec)/1000; dbg(1,"delta=%d flush_time=%d\n", delta, this_->flush_time); - if (this_->flush_time && delta > this_->flush_time*1000) + if (this_->flush_time && delta >= this_->flush_time*1000) log_flush(this_); return TRUE; } @@ -239,7 +245,9 @@ ret->timer=g_timeout_add(ret->flush_time*1000, log_timer, ret); } expand_filenames(ret); - if (! ret->lazy) + if (ret->lazy) + log_set_last_flush(ret); + else log_open(ret); ret->attrs=attr_list_dup(attrs); return ret; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |