[Quickfix-users] Possible bug in Session::isSameSession()?
Brought to you by:
orenmnero
|
From: Brendan B. B. <br...@ka...> - 2003-08-22 08:57:54
|
Hello,
This is to report a possible bug in Session::isSameSession().
Suppose on Thursday 8/21 StartTime=09:00:00, EndTime=16:00:00 and the
contents of the .session file (m_creationTime) are 20030820-10:00:00
(assume all times are UTC).
If the current time is 9:45, in Session::isSameSession() the calls to
Session::isSameSession() will not trigger a return false and thus
fall to:
return (time1 - time2 <= UTC_DAY);
Since (time1 (8/21 9:45) - time2 (8/20 10:00)) is <= UTC_DAY
Session::isSameSession() will return true and the session will not be
reset.
If instead the check is if the session end time (converted to today's
date) is >= m_creationTime + 24h, e.g.
UtcTimeStamp l_dt(end.getHour(), end.getMinute(), end.getSecond());
return (l_dt - time2 < UTC_DAY);
then since (end (8/21 16:00:00) - time2 (8/20 10:00)) is > UTC_DAY
then Session::isSameSession() will return false and the session will
be reset e.g. the session will be reset if the previous
m_creationTime is more than a day prior to the current day's end
session time.
Note I checked return (l_dt - time2 < UTC_DAY) and not return (l_dt -
time2 <= UTC_DAY) because if m_creationTime == EndTime then (end
(8/21 16:00:00) - time2 (8/20 16:00:00)) == 86400 and thus the reset
wouldn't occur.
Comments welcome.
Regards,
Brendan
|