|
30 | 30 | parser.add_argument('--insecure', help='do not verify SSL certificate', action='store_true')
|
31 | 31 | parser.add_argument('-r', '--no_remap_teams', help='do not remap team ID\'s to team ID\'s of contest from API.', action='store_true')
|
32 | 32 | parser.add_argument('-i', '--internal_data_source', help='The API uses an internal API source.', action='store_true')
|
| 33 | +parser.add_argument('-f', '--simulation_speed', help='Speed up replay speed by this factor.') |
33 | 34 |
|
34 | 35 | args = parser.parse_args()
|
35 | 36 |
|
|
100 | 101 | logging.info('Contest will be started at '
|
101 | 102 | + time.strftime('%X %x %Z', time.localtime(contest_start)) + '.')
|
102 | 103 | simulation_speed = orig_contest_duration/contest_duration
|
| 104 | +if args.simulation_speed: |
| 105 | + simulation_speed = float(args.simulation_speed) |
103 | 106 | logging.info(f'Simulation speed: {simulation_speed}')
|
104 | 107 |
|
105 | 108 | if args.internal_data_source:
|
|
119 | 122 | if not submission['id']:
|
120 | 123 | continue
|
121 | 124 | times = submission['contest_time'].split(':')
|
122 |
| - orig_submission_time = int(times[0])*3600 + int(times[1])*60 + float(times[2]) |
| 125 | + hours = int(times[0]) |
| 126 | + minutes = int(times[1]) |
| 127 | + seconds = float(times[2]) |
| 128 | + orig_submission_time = hours*3600 + minutes*60 + seconds |
123 | 129 | new_submission_time = orig_submission_time/simulation_speed
|
124 | 130 | time_from_start = time.time() - contest_start
|
125 | 131 | time_diff = new_submission_time - time_from_start
|
126 | 132 | if time_diff > 0:
|
127 |
| - logging.info(f'Waiting for simulated contest time of {times[0]}:{times[1]}:{times[2]}.') |
| 133 | + logging.info(f'Waiting for simulated contest time of {hours}:{minutes:02}:{seconds:06.3f}.') |
128 | 134 | spinner = Halo(spinner='dots', text=f'Sleeping for ~{str(round(time_diff,2))}s')
|
129 | 135 | spinner.start()
|
130 | 136 | while time_diff > 1:
|
|
0 commit comments