@echo off & setlocal
:same as TIMESET but includes date for this lousy-clock computer!
del timer.pl
:for /f "tokens=3" %%a in ('find /i "activetimebias"^<timezone.bat') do set xx=%%a
for /f "tokens=3" %%a in ('REG query HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation ^| find /i "standardname"') do set zone=%%a
echo %zone%
date /t >> timeset.log
wget http://tycho.usno.navy.mil/cgi-bin/timer.pl
for /f "tokens=3-6 delims=: " %%a in ('find /i "%zone%" timer.pl') do (
:echo hour: %%a ampm %%d
set hour=%%a
set min=%%b
set sec=%%c
set ampm=%%d
)
set hour=%hour:0=%
echo %hour%
if /i %ampm% equ pm set /a ((hour+=12)%%24)
if /i "%1" equ "set" (
echo %hour%:%min%:%sec% | time >> timeset.log
) else (
time /t | time >> timeset.log
)
>> timeset.log echo %1 USNO atomic clock: %hour%:%min%:%sec%
>> timeset.log echo ----------------------
echo usno time: %hour%:%min%:%sec%
if /i "%1" neq "set" goto :eof

:: now do date
set yr=%date:~10,4%
set jan=1
set feb=2
set mar=3
set apr=4
set may=5
set jun=6
set jul=7
set aug=8
set sep=9
set oct=10
set nov=11
set dec=12
for /f "tokens=2-4 delims=>., " %%a in ('find /i "%zone%" ^<timer.pl') do (
set mo=%%a
set day=%%b
)
call :conv %%%mo%%%
echo %month%/%day%/%yr% | date
goto :Eof

:conv
set month=%1
