Skip to content

Commit

Permalink
Rearranged time so that exiting before duration still records time in
Browse files Browse the repository at this point in the history
file.
  • Loading branch information
w9cf committed Mar 24, 2024
1 parent f8116e4 commit e49f7f2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions python/contest.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,17 @@ def time(self):
return (h,m,s)

def checkDuration(self):
self.seconds = self.bufcount*self._bufsize/self._rate
if self.mode in [RunMode.single, RunMode.pileup]:
if self.duration < self.bufcount*self._bufsize/(self._rate*60):
self.seconds = self.bufcount*self._bufsize/self._rate
if self.duration < self.seconds/60:
self.me.app.contestEnded()
elif self.mode in [RunMode.single_qsonr, RunMode.pileup_qsonr]:
if (self.me.app.nrchecked >= self.duration and
self.me.state != StationState.Sending):
tsec = self.bufcount*self._bufsize/self._rate
if self._extratime == 0:
self._extratime = tsec+0.5 #continue for 1/2 second
elif tsec > self._extratime:
self._extratime = self.seconds+0.5 #continue for 1/2 second
elif self.seconds > self._extratime:
self._extratime = 0
self.seconds = tsec
self.me.app.contestEnded()

def readConfig(self,filename):
Expand Down

0 comments on commit e49f7f2

Please sign in to comment.