Last change
on this file since 65 was 59, checked in by Wouter Pasman, 3 years ago |
#44 manual commit of first public release, because this will cause the dist directory to move
|
File size:
1000 bytes
|
Line | |
---|
1 | from datetime import datetime
|
---|
2 |
|
---|
3 | from geniusweb.deadline.Deadline import Deadline
|
---|
4 | from geniusweb.deadline.DeadlineRounds import DeadlineRounds
|
---|
5 | from geniusweb.deadline.DeadlineTime import DeadlineTime
|
---|
6 | from geniusweb.progress.Progress import Progress
|
---|
7 | from geniusweb.progress.ProgressRounds import ProgressRounds
|
---|
8 | from geniusweb.progress.ProgressTime import ProgressTime
|
---|
9 |
|
---|
10 |
|
---|
11 | class 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()))
|
---|
24 | else:
|
---|
25 | return ProgressTime(deadline.getDuration(),datetime.fromtimestamp(nowms))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.