Solved time keeper is not keeping time

July 22, 2012 at 18:36:48
Specs: Windows 7
i have writen a simple time keeping batch file.
what is happing: i start it and it skips, it starts at 0 and within 10 secants the hour reader says its already at 600 hours...

@echo off
color 0a
set timer=1
set minute=0
set hour=0
set up=1
set 60=60
set /p sec=set seconts:
echo 1.) to start
set /p var=set command:
if %var%==1 goto 1

set /a timer=%timer% + %sec%
echo %hour% %minute% %timer%
if %timer% geq %60% goto 2

ping localhost n1>nul
goto 1
set /a minute=%minute% + %up%
if %minute% geq %60% goto 3
set /a timer=0
goto 1
set /a hour=%hour% + %up%
set /a minute=0
set /a timer=0
goto 1

please help

See More: time keeper is not keeping time

Report •

July 22, 2012 at 22:08:42
✔ Best Answer
This is my view: You are trying to use two different methods of timing and you need to decide on ONE approach. Two types of "timers": counters, and matchers. A counter counts seconds, or minutes, from "Now". A "matcher" looks for a specified tiime to occur. It looks to me like your script has got them confused. They can be interchangeable, but only by using "date/time" math, which handles all the specifics of our real-time calendar and clocks (leap-years, leap-seconds, daylight savings etc.) My guess, you DON"T want to deal with that stuff...
If you just want a counter:
set cnt=0
:setting for 23 seconds
set wait=23
ping -n 1 -w %wait%000 > nul 2>1

Report •

July 25, 2012 at 20:23:10
ok thank you ill try that

Report •

Related Solutions

Ask Question