- timeMap::iterator it = m_timemap_cursor;
- --it;
- if ( (it->second->getStartTime() + it->second->getDuration()) > begin )
- m_timemap_cursor = it;
+ if ( m_timemap_cursor->second->getStartTime() != begin )
+ {
+ timeMap::iterator x = m_timemap_cursor;
+ --x;
+ if ( x != It->second.second.end() )
+ {
+ time_t start_time = x->second->getStartTime();
+ if ( begin > start_time && begin < (start_time+x->second->getDuration()))
+ m_timemap_cursor = x;
+ }
+ }