eontimer_to_flowtimer.py
· 779 B · Python
原始檔案
from math import floor
FRAME_RATE = 59.8261
TARGET_SEC = int(input("Target Seconds: "))
TARGET_DELAY = int(input("Target Delay: "))
CALIBRATED_DELAY = int(input("Calibrated Delay: "))
CALIBRATED_SECONDS = int(input("Calibrated Seconds: "))
ONE_MIN = 60000
MINIMUM_TIME_MS = 14000
PRETIMER = 5000
def toms(ms):
return floor(ms / FRAME_RATE)
secondTimer = (toms(TARGET_DELAY * 1000 - CALIBRATED_DELAY * 1000) + CALIBRATED_SECONDS * 1000)
firstTimer = ((TARGET_SEC*1000 - secondTimer) % ONE_MIN + 200 )
secondTimer += 5000
firstTimer += 5000
if firstTimer < MINIMUM_TIME_MS:
firstTimer = firstTimer + ONE_MIN
minutesBefore = floor((firstTimer + secondTimer) / ONE_MIN)
print(f'{secondTimer}/{firstTimer}/{PRETIMER}\nMinutes Before Target: {minutesBefore}')
1 | from math import floor |
2 | |
3 | FRAME_RATE = 59.8261 |
4 | TARGET_SEC = int(input("Target Seconds: ")) |
5 | TARGET_DELAY = int(input("Target Delay: ")) |
6 | CALIBRATED_DELAY = int(input("Calibrated Delay: ")) |
7 | CALIBRATED_SECONDS = int(input("Calibrated Seconds: ")) |
8 | ONE_MIN = 60000 |
9 | MINIMUM_TIME_MS = 14000 |
10 | PRETIMER = 5000 |
11 | |
12 | |
13 | def toms(ms): |
14 | return floor(ms / FRAME_RATE) |
15 | |
16 | |
17 | secondTimer = (toms(TARGET_DELAY * 1000 - CALIBRATED_DELAY * 1000) + CALIBRATED_SECONDS * 1000) |
18 | firstTimer = ((TARGET_SEC*1000 - secondTimer) % ONE_MIN + 200 ) |
19 | secondTimer += 5000 |
20 | firstTimer += 5000 |
21 | |
22 | if firstTimer < MINIMUM_TIME_MS: |
23 | firstTimer = firstTimer + ONE_MIN |
24 | |
25 | |
26 | minutesBefore = floor((firstTimer + secondTimer) / ONE_MIN) |
27 | |
28 | print(f'{secondTimer}/{firstTimer}/{PRETIMER}\nMinutes Before Target: {minutesBefore}') |