CODE: [Copy to clipboard]
@echo off
mode con cols=78 lines=10
setlocal enabledelayedexpansion
title 时间周期推算工具
:lpStart
set D=8 13 21 34 55 89 144
::s为输入时间 hh为小时 mm为分 n为总分钟数
cls&set s= && set str=
echo 中国股市开盘时间:上午9:30~11:30 下午13:00~15:00&echo.
set /p s=输入预推算时间周期[24小时制,如9:35]:
for /f "tokens=1,2 delims=:" %%i in ('echo !s!') do set hh=%%i &set mm=%%j
set /a n=!hh! * 60 + !mm!
::判断下输入的时间是否为开盘时有效时间,不是则重定向
if !mm! geq 60 goto lpStart
if not defined hh goto lpStart
if not defined mm goto lpStart
if !n! geq 690 if !n! lss 780 echo.&echo 此时为中午休市时间 & pause>nul & goto lpStart
if !n! gtr 900 echo.&echo 此时为收盘休市时间 & pause>nul & goto lpStart
if !n! lss 570 echo.&echo 此时为开盘前休市时间 & pause>nul & goto lpStart
echo 输入的时间为:!s!&echo.
echo 推算数列: !D!
::将时间相加处理后得到总分数ZT
for %%i in (!D!) do (
set /a ZT=!n! + %%i
rem 此时为上午开盘时间
if !ZT! geq 570 if !ZT! leq 690 call :subTimeTurn !ZT!
rem 此时为下午开盘时间
if !ZT! geq 780 if !ZT! leq 900 call :subTimeTurn !ZT!
rem 此时为中午休市时间
if !ZT! geq 690 if !ZT! leq 780 set /a ZT+=90 && call :subTimeTurn !ZT!
rem 此时为收盘休市时间
if !ZT! gtr 900 set /a ZT-=330 && call :subTimeTurn !ZT!
)
echo.&echo 时间周期:!str!
pause>nul&goto lpStart
:subTimeTurn
set x=
set y=
set /a x=%1 / 60
set /a y=%1 - !x! * 60 -1
set str=!str! !x!:!y!
goto :eof
[