HeartBeat-Delay()-Wait()-Sleep()-Demos

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

HeartBeat-Delay()-Wait()-Sleep()-Demos

#1 Post by einstein1969 » 07 Mar 2016 09:49

Hi to all,

This thread is a for DEMOS of my HearBeat engine that emulate the WAIT()/DELAY()/SLEEP() functions whit no use of CPU (passive wait). With this code is possible control the CPU usage and the time.
It is possible create a more complex application/game.

HeartBeat_simple.cmd:

Code: Select all

:::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Heartbeat 0.2 By Einstein1969
::
:: Tested on Windows 7 32bit monocore @2Ghz
::
:: ver. 0.2 2016-03-11
::  - Add fast start.
::  - Add second set/P for bypass the problem of set/P that split
::    the input line of PING | FIND in 2 parts.
::  TODO: detect split of set/P and use the appropriate code.
::
:: ver. 0.1 2014-july
::  - Initial version

@echo off

setlocal EnableDelayedExpansion

rem Multithread dispatcher
if not "%1"=="" goto :%1

rem choose a HB parameter %1 to sature/stabilize the beat.
rem choice a HB parameter %2 to distribuite the beat at fast start.

rem choose the RICEVER parameter for achieve the minimum delay. Es. 20 is 20cs is 5FPS.

rem Use this for using HIGH priority processing and achieve more precision.
rem START "HB" /B /HIGH cmd /c "%~f0" HB 28 10 | find "TTL" | START "RICEVER" /B /HIGH cmd /c "%~f0" RICEVER 20

rem Example for 3 centisecond about 32FPS
"%~f0" HB 32 10 | find "TTL" | "%~f0" RICEVER 3

pause>nul

exit /b

:HB

 for /L %%N in (0,1,%2) do (

    pathping -n -q 1 -p %3 127.0.0.1 >nul
    start "HBPING" /B ping -n %2 127.0.0.1

 )

 for /L %%N in (0) do (

    ping -n 2 127.0.0.1 >nul
    start "HBPING" /B ping -n %2 127.0.0.1

 )

exit /b

:RICEVER

 for /L %%N in (0) do (
   set/p =
   set/p =
     set /a "t=1!time:~6,2!!time:~9,2!-10000, dt=t-(oldt+0), dt+=(dt>>31)&6000" >NUL
     if !dt! geq %2 (
        rem do work
        set/p ".=!dt! "<nul
        set /a oldt=t >NUL
     )
 )

exit/b



DEMO
This code is only a VERY simple demo with 16-18FPS that use ONLY 10-20% CPU on monocore.
This use the HeartBeat core version 0.1

Code: Select all

@echo off

setlocal EnableDelayedExpansion

if not "%1"=="" goto :%1

mode 64,60

"%~f0" HB 60 1010 | find "128" | "%~f0" MAIN 5

pause>nul

exit /b

:HB

 for /L %%N in (0) do (

    rem pathping -n -q 1 -p %3 127.0.0.1 >nul
        ping -n 2 127.0.0.1 >nul
   
    start "HBPING" /B ping -n %2 127.0.0.1

 )

exit /b

:MAIN

 set /a cols=62, lines=49

 set "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
 set "SIN(x)=(a=(x)%%62832, c=(a>>31|1)*a, t=((c-47125)>>31)+1, a-=t*((a>>31|1)*62832)  +  ^^^!t*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a)  ), %_SIN%)"
 set "_SIN="

 For /L %%l in (1,1,%cols%) do set "_empty=!_empty! "

 set "g=.@"

 set /a R=20, Angle=0, _dx=cols/2, _dy=lines/2, _1=10000


 for /L %%n in (0) do (

   set/p "_HB="

     set /a "t1=1!time:~6,2!!time:~9,2!-10000, dt=t1-oldt, dt+=(dt>>31)&6000" >NUL
     if !dt! geq %2 (

        cls
        For /L %%l in (5,1,%lines%) do echo( !L%%l!
        if !random:~-1! equ 0 For /L %%l in (5,1,%lines%) do set "L%%l="

        set /A "s1=%SIN(x):x=Angle%, c1=%SIN(x):x=15708-Angle%, Angle-=5*31416/180"

        For /L %%P in (0,4,!R!) do (

            set /A "a=(R-%%P)*s1/_1+%_dx%, b=(R-%%P)*c1/_1+5+%_dy%"

            if not defined L!b! set "L!b!=%_empty%"

            For /F "tokens=1-3" %%x in ("!a! !b! 1") do (
               set "c=!L%%y:~%%x!"
               set "L%%y=!L%%y:~0,%%x!!g:~%%z,1!!c:~1!"
            )
        )

        set/p ".=!dt! "<nul

        %= Frame counter =%
        Set /A F+=1

        %= Calculate FPS every 4 seconds=%
        if !F! geq !\! call :calc_FPS


        set /a oldt=t1 >NUL
     )
 )

exit/b

:Calc_FPS
  set /a "dT1=1!time:~-5,-3!!time:~-2!-(t0f+0), dT1+=(dT1>>31) & 6000, fps=(F-old\)*100*100 / dT1, t0f=(t0f+0)+dT1, old\=F, \+=4*fps/100"
  Title Fps:!fps:~0,-2!.!fps:~-2! #!F!
  set dT1=
exit/b


EDIT: I have achieved about 25FPS with 25%CPU usage changing the line

Code: Select all

"%~f0" HB 60 1010 | find "128" | "%~f0" MAIN 5

to

Code: Select all

"%~f0" HB 60 1010 | find "128" | "%~f0" MAIN 3

Einstein1969
Last edited by einstein1969 on 16 Mar 2016 05:31, edited 2 times in total.

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#2 Post by einstein1969 » 11 Mar 2016 08:25

I have released version 0.2 of HeartBeat core. Look at initial post of the thread.

Soon I release a RADAR demo with LINE and FADER effect! Stay Tuned!

Einstein1969

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#3 Post by npocmaka_ » 11 Mar 2016 14:42

Are the two scripts supposed to do the same thing?

The fist one (looks really cool) emulates radar circle while the version 0.2 fills the console with numbers.

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#4 Post by einstein1969 » 12 Mar 2016 09:32

The first script print on screen the delay/sleep/wait time (in centiseconds) only.
The second script use the same tecnic of the first script for do an application. Is a DEMO for the first code.
I'll do other DEMO of this implementation of sleep/wait/delay using PING and set/P. It's possible not use the FIND but
the result maybe is use more CPU... I not have tested for now.

Einstein1969

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#5 Post by einstein1969 » 15 Mar 2016 14:45

Hi,

This is the RADAR like DEMO. Use LINE and FADING...

It use only 60-80% CPU about on single core leaving some resource free. Use the HeartBeat logic at very high FPS.

This demo run at same speed on different PC. It use a "angular" speed costant.

It is possible change the number of FPS without slow down or accelerate the radar!

Use font 8x8.

Code: Select all

@echo off

setlocal EnableDelayedExpansion

if not "%1"=="" goto :%1

color 0f
mode 72,71
chcp 850
ping -n 2 127.0.0.1 >nul

"%~f0" HB 24 10 | find "TTL" | "%~f0" MAIN 4

exit /b

:MAIN

 for /f "delims==" %%v in ('set') do set "%%v="

 set /A "xres=70, yres=70

  for /l %%y in (1 1 !yres!) do (
    set "Lines%%y="
    for /l %%x in (1 1 !xres!) do set "lines%%y=!lines%%y! "
  )

 set g=.Û

 :: PI=31416

 set "SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
 set "SIN(x)=(a=(x)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832)  +  (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a)  ), %SIN%)"
 set "SIN="

 set /A Angle=0, Radius=xres/2-2

 set t0=%time%

(

Rem Empty Env, use percent expand.
set SIN(x^)=
set xres=
set yres=
set Radius=

 for /L %%N in (0) do (

   set/p =
   set/p =

   set /a "t=1!time:~6,2!!time:~9,2!-10000, dt=t-(oldt+0), dt+=(dt>>31)&6000" >NUL
   if !dt! geq %2 (

        cls & for /l %%? in (1, 1,%yres%) do echo( !Lines%%?!

        for /F "tokens=1-8 delims=:.," %%a in ("%t0: =0%:!time: =0!") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31) & 8640000, angle=a/2"

        rem set /A Angle+=3

        For /L %%y in (0,1,%yres%) do (

          set Lines%%y=!Lines%%y:°= !
          set Lines%%y=!Lines%%y:±=°!
          set Lines%%y=!Lines%%y:²=±!
          set Lines%%y=!Lines%%y:Û=²!

        )

        set /A "x1=%Xres%/2, y1=%Yres%/2, x2=%Xres%/2+%SIN(x):x=15708-Angle*31416/180%*%Radius%/10000, Y2=%Yres%/2+%SIN(x):x=Angle*31416/180%*%Radius%/10000, dx=x2-x1, dx=dx*(dx>>31|1), dy=y2-y1, dy=dy*(dy>>31|1)"

        if !dy! leq !dx! (
          if !x2! lss !x1! set /A t=x2, x2=x1, x1=t, t=y2, y2=y1, y1=t
   
          if !y2! gtr !y1! (
            set /A yincr=1
          ) else set /A yincr=-1

          set /a "d=2*dy-dx, Eincr=2*dy, NEincr=2*(dy-dx)"

          For /F usebackq^ tokens^=1-3 %%x in ('!x1! !y1! 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"

          set /A x1+=1
          for /L %%X in (!x1!,1,!x2!) do (
            if !d! lss 0 (
               set /A d+=Eincr
            ) else set /A d+=NEincr, y1+=yincr
     
            For /F usebackq^ tokens^=1-3 %%x in ('%%X !y1! 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"

          )
        ) else (
          if !y2! lss !y1! set /A t=x2, x2=x1, x1=t, t=y2, y2=y1, y1=t
          if !x2! gtr !x1! (
            set /A yincr=1
          ) else set /A yincr=-1
          set /a "d=2*dx-dy, Eincr=2*dx, NEincr=2*(dx-dy)"
   
          For /F usebackq^ tokens^=1-3 %%x in ('!x1! !y1! 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"

          set /a y1+=1
          for /L %%Y in (!y1!,1,!y2!) do (
            if !d! lss 0 (
              set /a d+=Eincr
            ) else set /A d+=NEincr, x1+=yincr
            For /F usebackq^ tokens^=1-3 %%x in ('!x1! %%Y 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"
          )
        )

        set /a oldt=t >NUL
     )
 )

)
exit/b


:HB

 for /L %%N in (0,1,%2) do (

    pathping -n -q 1 -p %3 127.0.0.1 >nul
    start "HBPING" /B ping -n %2 127.0.0.1

 )

 for /L %%N in (0) do (

    ping -n 2 127.0.0.1 >nul
    start "HBPING" /B ping -n %2 127.0.0.1

 )

exit /b


Einstein1969

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#6 Post by foxidrive » 16 Mar 2016 03:59

einstein1969 wrote:Hi,

This is the RADAR like DEMO. Use LINE and FADING...

It use only 60-80% CPU about on single core leaving some resource free. Use the HeartBeat logic at very high FPS.

This demo run at same speed on different PC. It use a "angular" speed costant.

It is possible change the number of FPS without slow down or accelerate the radar!

Use font 8x8.


It's cool. Is the sweep supposed to be smooth or alter in around 45 degree bites? It does the latter here but works well.

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#7 Post by einstein1969 » 16 Mar 2016 05:27

It should be smooth but it should be made a parameter tuning. On a fast machine like yours may not work. Try to increase the parameter 24 in the left side of the pipe. Try to put "%~f0" HB 32 10 and retest "%~f0" HB 48 10.

The 24 is the number of concurrent PING that execute. Look at task manager for view.


Einstein1969

EDIT: Try to wait for 20-30 seconds to stabilize. Mainwhile I'm rewriting the code of heartbeat (ver 0.3) for better smooth.
This is REALLY DIFFICULT. :(

EDIT2: if stabilize after 20-40 second then probe to start with "%~f0" HB 24 40 or "%~f0" HB 24 30
The second parameter controll the delay between the ping for smooting at fast start.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#8 Post by foxidrive » 16 Mar 2016 06:22

With 32 it is still a little jerky but with 48 it starts wonderfully smoothly.

With 24 and 32 and 48 - after 30 to 60 odd seconds they all become almost like a line that switches place in an arc, rather than moving. That's interesting behaviour.

It's a neat demo.

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#9 Post by einstein1969 » 16 Mar 2016 10:12

I do not understand what happens. You could make a movie?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#10 Post by foxidrive » 16 Mar 2016 12:48

Here's a video: this is 1:15 long but the behaviour changes around 55 seconds.

http://tinypic.com/r/2m3guc2/9

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#11 Post by einstein1969 » 16 Mar 2016 15:13

Ok, there is a problem...

I'm working on possible solution. I think that the problem is connected to fast or multicore machine. On my old monocore machine the problem not appear.

The possible solutions are using a formula for dividing the interval OR using random variable... Tomorrow. Now it's too late. :?

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#12 Post by einstein1969 » 18 Mar 2016 11:49

Can you test this version?

Code: Select all

:: Radar ver. 0.2
@echo off

setlocal EnableDelayedExpansion

if not "%1"=="" goto :%1

color 0f
mode 72,71
chcp 850
ping -n 2 127.0.0.1 >nul

Rem Use FPS how input
Set /A FPS=20

rem Second parameter of HB is Multiply for fast PC. Use 1 for slow/monocore PC, 2 or 3 for fast/multicore PC.
"%~f0" HB %FPS% 2 | find "TTL" | "%~f0" MAIN %FPS%

exit /b

:MAIN

 for /f "delims==" %%v in ('set') do set "%%v="

 Set /A Delay_CS=(1000/%2+5)/10

 set /A "xres=70, yres=70

  for /l %%y in (1 1 !yres!) do (
    set "Lines%%y="
    for /l %%x in (1 1 !xres!) do set "lines%%y=!lines%%y! "
  )

 set g=.Û

 :: PI=31416

 set "SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
 set "SIN(x)=(a=(x)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832)  +  (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a)  ), %SIN%)"
 set "SIN="

 set /A Angle=0, Radius=xres/2-2

 set t0=%time%

(

Rem Empty Env, use percent expand.
set SIN(x^)=
set xres=
set yres=
set Radius=
set Delay_CS=

 for /L %%N in (0) do (

   set/p =
   set/p =

   set /a "t=1!time:~6,2!!time:~9,2!-10000, dt=t-(oldt+0), dt+=(dt>>31)&6000" >NUL
   if !dt! geq %Delay_CS% (

        cls & for /l %%? in (1, 1,%yres%) do echo( !Lines%%?!

        for /F "tokens=1-8 delims=:.," %%a in ("%t0: =0%:!time: =0!") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31) & 8640000, angle=a/2"

        rem set /A Angle+=3

        For /L %%y in (0,1,%yres%) do (

          set Lines%%y=!Lines%%y:°= !
          set Lines%%y=!Lines%%y:±=°!
          set Lines%%y=!Lines%%y:²=±!
          set Lines%%y=!Lines%%y:Û=²!

        )

        set /A "x1=%Xres%/2, y1=%Yres%/2, x2=%Xres%/2+%SIN(x):x=15708-Angle*31416/180%*%Radius%/10000, Y2=%Yres%/2+%SIN(x):x=Angle*31416/180%*%Radius%/10000, dx=x2-x1, dx=dx*(dx>>31|1), dy=y2-y1, dy=dy*(dy>>31|1)"

        if !dy! leq !dx! (
          if !x2! lss !x1! set /A t=x2, x2=x1, x1=t, t=y2, y2=y1, y1=t
   
          if !y2! gtr !y1! (
            set /A yincr=1
          ) else set /A yincr=-1

          set /a "d=2*dy-dx, Eincr=2*dy, NEincr=2*(dy-dx)"

          For /F usebackq^ tokens^=1-3 %%x in ('!x1! !y1! 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"

          set /A x1+=1
          for /L %%X in (!x1!,1,!x2!) do (
            if !d! lss 0 (
               set /A d+=Eincr
            ) else set /A d+=NEincr, y1+=yincr
     
            For /F usebackq^ tokens^=1-3 %%x in ('%%X !y1! 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"

          )
        ) else (
          if !y2! lss !y1! set /A t=x2, x2=x1, x1=t, t=y2, y2=y1, y1=t
          if !x2! gtr !x1! (
            set /A yincr=1
          ) else set /A yincr=-1
          set /a "d=2*dx-dy, Eincr=2*dx, NEincr=2*(dx-dy)"
   
          For /F usebackq^ tokens^=1-3 %%x in ('!x1! !y1! 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"

          set /a y1+=1
          for /L %%Y in (!y1!,1,!y2!) do (
            if !d! lss 0 (
              set /a d+=Eincr
            ) else set /A d+=NEincr, x1+=yincr
            For /F usebackq^ tokens^=1-3 %%x in ('!x1! %%Y 1') do set c=!Lines%%y:~%%x!& set "Lines%%y=!Lines%%y:~0,%%x!!g:~%%z,1!!c:~1!"
          )
        )

        set /a oldt=t >NUL
     )
 )

)
exit/b

:HB

 Set /A Delay_Fast_Start=1000/(%~2)/(%~3), Delay_Running=1000+Delay_Fast_Start, C=%~2*%~3

 for /L %%N in (0,1,%C%) do (

    pathping -n -q 1 -p %Delay_Fast_Start% 127.0.0.1 >nul
    start "HBPING" /B ping -n %C% 127.0.0.1

 )

 for /L %%N in (0) do (

    pathping -n -q 1 -p %Delay_Running% 127.0.0.1 >nul
    start "HBPING" /B ping -n %C% 127.0.0.1

 )

exit /b


If there is the same problem can you try change the line

Code: Select all

"%~f0" HB %FPS% 2 | find "TTL" | "%~f0" MAIN %FPS%

to

Code: Select all

"%~f0" HB %FPS% 3 | find "TTL" | "%~f0" MAIN %FPS%


The HeartBeat is not omogeneus with this algorithm. :?
Any suggestion is welcome.


This is the HeartBeat CORE ver.0.3 BETA:

Code: Select all

:::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Heartbeat 0.3 By Einstein1969
::
:: Tested on Windows 7 32bit monocore @2Ghz
::
:: ver. 0.3 2016-03-17
::  - Beta
::
:: ver. 0.2 2016-03-11
::  - Add fast start.
::  - Add second set/P for bypass the problem of set/P that split
::    the input line of PING | FIND in 2 parts.
::  TODO: detect split of set/P and use the appropriate code.
::
:: ver. 0.1 2014-july
::  - Initial version

@echo off

setlocal EnableDelayedExpansion

rem Multithread dispatcher
if not "%1"=="" goto :%1

rem Use this for using HIGH priority processing and achieve more precision.
rem START "HB" /B /HIGH cmd /c "%~f0" HB %FPS% | find "TTL" | START "RICEVER" /B /HIGH cmd /c "%~f0" RICEVER %FPS%

Rem For DEBUG
mode 120,80

Rem Use FPS how input
Set /A FPS=20

rem Second parameter of HB is Multiply for fast PC. Use 1 for slow/monocore PC, 2 or 3 for fast/multicore PC.
"%~f0" HB %FPS% 2 | find "TTL" | "%~f0" MAIN %FPS%

pause>nul

exit /b

:HB


 Set /A Delay_Fast_Start=1000/(%~2)/(%~3), Delay_Running=1000+Delay_Fast_Start, C=%~2*%~3
 echo Delay_Fast_Start=%Delay_Fast_Start% - Delay_Running=%Delay_Running% C=%C% > con:

 Title HB:Fast Start
 for /L %%N in (0,1,%C%) do (

    pathping -n -q 1 -p %Delay_Fast_Start% 127.0.0.1 >nul
    start "HBPING" /B ping -n %C% 127.0.0.1

 )

 Title HB:Wait...
 for /L %%N in (0,1,%C%) do (

    pathping -n -q 1 -p %Delay_Running% 127.0.0.1 >nul
    start "HBPING" /B ping -n %C% 127.0.0.1

 )

 Title HB:Running...
 for /L %%N in (0) do (

    pathping -n -q 1 -p %Delay_Running% 127.0.0.1 >nul
    start "HBPING" /B ping -n %C% 127.0.0.1

 )


exit /b

:RICEVER

 rem Round the result
 Set /A Delay_CS=(1000/%2+5)/10
 echo Delay_CS=%Delay_CS%

 for /L %%N in (0) do (
   set/p =
   set/p =
     set /a "t=1!time:~6,2!!time:~9,2!-10000, dt=t-(oldt+0), dt+=(dt>>31)&6000" >NUL
     if !dt! geq %Delay_CS% (
        rem do work
        set/p ".=!dt! "<nul
        set /a oldt=t >NUL
     )
 )

exit/b


Einstein1969

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: HeartBeat-Delay()-Wait()-Sleep()-Demos

#13 Post by foxidrive » 18 Mar 2016 13:22

einstein1969 wrote:Can you test this version?


It works well here Einstein. After 10 minutes the sweep is going great.

Cheers

Post Reply