1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
@ECHO OFF
REM can only from 0 to 60 Sekunden be set
SET limit=%1
REM without parameter 3 Sekunden default setting
IF %limit%\==\ SET limit=3
::extracts the second part from time
FOR /f "tokens=1-3 delims=:" %%i in ("%time%") do set sec=%%k
FOR /f "tokens=1-2 delims=," %%i in ("%sec%") do (
set secUnit=%%i
)
SET tempsdepart=%secUnit%
:Recommencer
FOR /f "tokens=1-3 delims=:" %%i in ("%time%") do set sec=%%k
FOR /f "tokens=1-2 delims=," %%i in ("%sec%") do (
set secUnit=%%i
)
SET tempsfin=%secUnit%
SET /A Testdp=%tempsdepart% + %limit%
:: avoids tempsfin overlap of 60er seconds
IF %Testdp% GEQ 60 (SET /A tempsdepart=%Testdp% - 60
SET /A tempsfin=%tempsfin% + %limit%)
SET /A tempscal=%tempsfin% - %tempsdepart%
IF %tempscal% LSS %limit% GOTO Recommencer
:FIN
ECHO tempsdepart : %tempsdepart%
ECHO tempsfin : %tempsfin%
ECHO tempscal : %tempscal% |