Fixed fixed section lengths to start on boundary.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@936 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-03-09 17:04:15 +00:00
parent d61514c15d
commit ba2820ef37
1 changed files with 15 additions and 2 deletions

View File

@ -648,6 +648,7 @@ bool Monitor::Analyse()
static struct timeval **timestamps; static struct timeval **timestamps;
static Image **images; static Image **images;
static int last_section_mod = 0;
unsigned int score = 0; unsigned int score = 0;
if ( Ready() ) if ( Ready() )
@ -663,12 +664,18 @@ bool Monitor::Analyse()
{ {
if ( state == IDLE || state == TAPE ) if ( state == IDLE || state == TAPE )
{ {
if ( (timestamp->tv_sec - event->StartTime().tv_sec) >= section_length ) int section_mod = timestamp->tv_sec%section_length;
if ( section_mod < last_section_mod )
{ {
Info(( "Ended event" )); Info(( "Ended event" ));
gettimeofday( &(event->EndTime()), &dummy_tz ); gettimeofday( &(event->EndTime()), &dummy_tz );
delete event; delete event;
event = 0; event = 0;
last_section_mod = 0;
}
else
{
last_section_mod = section_mod;
} }
} }
} }
@ -795,12 +802,18 @@ bool Monitor::Analyse()
{ {
if ( state == IDLE || state == TAPE ) if ( state == IDLE || state == TAPE )
{ {
if ( (timestamp->tv_sec - event->StartTime().tv_sec) >= section_length ) int section_mod = timestamp->tv_sec%section_length;
if ( section_mod < last_section_mod )
{ {
Info(( "Ended event" )); Info(( "Ended event" ));
gettimeofday( &(event->EndTime()), &dummy_tz ); gettimeofday( &(event->EndTime()), &dummy_tz );
delete event; delete event;
event = 0; event = 0;
last_section_mod = 0;
}
else
{
last_section_mod = section_mod;
} }
} }
} }