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

Last change on this file since 100 was 100, checked in by ruud, 19 months ago

python installs also wheel to avoid error messages

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.