Timers in a pinch

I hate to double post, but after considerable documentation reading, and taking the inability of cmd to give a good workable timer personally, I give you a this 2 liner:
Code:
cmd /V
set start=%time% & pause & set stop=!time! & set /a duration=((!stop:~3,2!*60+!stop:~6,2!)*100+!stop:~9,2!)-((!start:~3,2!*60+!start:~6,2!)*100+!start:~9,2!) > nul & echo !duration:~0,-2!.!duration:~-2!

Now granted, this fails the "you can do it from memory" test miserably. Also, it fails at 8 and 9 minutes past the hour, as well as 8 and 9 seconds past the minute. Also, if you start and and end in different hours (ie. start at 2:59 pm and end ad 3:01 pm) bad things happen.
These is easily fixed, but I'm already pushing the reasonable limits of one-liner cmd scripts. Actually I think I said "Screw you, limits" a long time ago.

At any rate, it's nice to know I actually get to go to bed tonight. You know how most of you can't go to sleep before all your puzzles are solved? Same gene, different target.
 
I hate to double post, but after considerable documentation reading, and taking the inability of cmd to give a good workable timer personally, I give you a this 2 liner:
Code:
cmd /V
set start=%time% & pause & set stop=!time! & set /a duration=((!stop:~3,2!*60+!stop:~6,2!)*100+!stop:~9,2!)-((!start:~3,2!*60+!start:~6,2!)*100+!start:~9,2!) > nul & echo !duration:~0,-2!.!duration:~-2!

Now granted, this fails the "you can do it from memory" test miserably. Also, it fails at 8 and 9 minutes past the hour, as well as 8 and 9 seconds past the minute. Also, if you start and and end in different hours (ie. start at 2:59 pm and end ad 3:01 pm) bad things happen.
These is easily fixed, but I'm already pushing the reasonable limits of one-liner cmd scripts. Actually I think I said "Screw you, limits" a long time ago.

At any rate, it's nice to know I actually get to go to bed tonight. You know how most of you can't go to sleep before all your puzzles are solved? Same gene, different target.

So true. .
 
I just forgot about ctrl+C

Here's something that's a lot shorter.


@echo off
set time=0
cls
echo Press any key to start timer!
pause>nul
:start
ping localhost -n 2 >nul
set /a time=%time%+1
cls
echo Hold ctrl+C to stop!
echo %time% sec.
goto start


YOU HAVE TO PUT THIS IN A TEXT FILE AND SAVE IT AS TIMER.BAT

That's my timer.
 
Back
Top