source: geniuswebcore/geniusweb/progress/ProgressFactory.py@ 74

Last change on this file since 74 was 73, checked in by Bart Vastenhouw, 3 years ago

Fix for IssueValue hashcode.

File size: 1015 bytes
Line 
1from datetime import datetime
2
3from geniusweb.deadline.Deadline import Deadline
4from geniusweb.deadline.DeadlineRounds import DeadlineRounds
5from geniusweb.deadline.DeadlineTime import DeadlineTime
6from geniusweb.progress.Progress import Progress
7from geniusweb.progress.ProgressRounds import ProgressRounds
8from geniusweb.progress.ProgressTime import ProgressTime
9
10
11class ProgressFactory:
12 @staticmethod
13 def create( deadline: Deadline, nowms:int) -> Progress :
14 '''
15 @param deadline the deadline to create a progress for
16 @param nowms The time as from {@link System#currentTimeMillis()} that
17 is to be used as start time for the progress.
18 @return new Progress matching the deadline type.
19 '''
20 assert isinstance(deadline, Deadline)
21 if isinstance(deadline,DeadlineRounds):
22 return ProgressRounds( deadline.getRounds(),
23 0, datetime.fromtimestamp( (nowms + deadline.getDuration())/1000.))
24 else:
25 return ProgressTime(deadline.getDuration(),datetime.fromtimestamp(nowms/1000.))
Note: See TracBrowser for help on using the repository browser.