anchor.diff:  if not %NLOOPS%==1 echo Start at %TIME% & set "T0=%TIME%"
   for /l %%n in (1,1,%NLOOPS%) do %EXEC% !CMDLINE!
   if not %NLOOPS%==1 echo End at %TIME% & set "T1=%TIME%"
  -if not %NLOOPS%==1 call :Time.Delta %T0% %T1% -f & echo Delta = !DH!:!DM!:!DS!.!DMS:~0,2!
  +if not %NLOOPS%==1 call :Time.Delta %T0% %T1% -f D & echo Delta = !D.HOUR!:!D.MINUTE!:!D.SECOND!.!D.MS:~0,2!
   %CMD_AFTER%
   goto :eof
   
  
positive.code: :#                                                                            #
  :#  Function        Time.Delta                                                #
  :#                                                                            #
  :#  Description     Compute the difference between two times                  #
  :#                                                                            #
  :#  Returns         Environment variables DC DH DM DS DMS                     #
  :#                  for carry, hours, minutes, seconds, milliseconds          #
  :#                                                                            #
  :#  Notes 	    Carry == 0, or -1 if the time flipped over midnight.      #
  :#                                                                            #
  :#  History                                                                   #
  :#   2012-10-08 JFL Created this routine.                                     #
  :#   2012-10-12 JFL Renamed variables. Added support for milliseconds.        #
  :#                                                                            #
  :#----------------------------------------------------------------------------#
  
  :Time.Delta %1=T0 %2=T1 [%3=-f]. Input times in HH:MM:SS[.mmm] format.
  setlocal enableextensions enabledelayedexpansion
  for /f "tokens=1,2,3,4 delims=:." %%a in ("%~1") do set "H0=%%a" & set "M0=%%b" & set "S0=%%c" & set "MS0=%%d000" & set "MS0=!MS0:~0,3!"
  for /f "tokens=1,2,3,4 delims=:." %%a in ("%~2") do set "H1=%%a" & set "M1=%%b" & set "S1=%%c" & set "MS1=%%d000" & set "MS1=!MS1:~0,3!"
  :# Remove the initial 0, to avoid having numbers interpreted in octal afterwards. (MS may have 2 leading 0s!)
  for %%n in (0 1) do for %%c in (H M S MS MS) do if "!%%c%%n:~0,1!"=="0" set "%%c%%n=!%%c%%n:~1!"
  :# Compute differences
  for %%c in (H M S MS) do set /a "D%%c=%%c1-%%c0"
  set "DC=0" & :# Carry  
  :# Report carries if needed
  if "%DMS:~0,1%"=="-" set /a "DMS=DMS+1000" & set /a "DS=DS-1"
  if "%DS:~0,1%"=="-" set /a "DS=DS+60" & set /a "DM=DM-1"
  if "%DM:~0,1%"=="-" set /a "DM=DM+60" & set /a "DH=DH-1"
  if "%DH:~0,1%"=="-" set /a "DH=DH+24" & set /a "DC=DC-1"
  :# If requested, convert the results back to a 2-digit format.
  if "%~3"=="-f" for %%c in (H M S MS) do if "!D%%c:~1!"=="" set "D%%c=0!D%%c!"
  if "!DMS:~2!"=="" set "DMS=0!DMS!"
  endlocal & set "DC=%DC%" & set "DH=%DH%" & set "DM=%DM%" & set "DS=%DS%" & set "DMS=%DMS%" & goto :eof
  
  :#----------------------------------------------------------------------------#
  :#                                                                            #
  
negative.code: if not %NLOOPS%==1 echo Start at %TIME% & set "T0=%TIME%"
  for /l %%n in (1,1,%NLOOPS%) do call !CMDLINE!
  if not %NLOOPS%==1 echo End at %TIME% & set "T1=%TIME%"
  if not %NLOOPS%==1 call :Time.Delta %T0% %T1% -f D & echo Delta = !D.HOUR!:!D.MINUTE!:!D.SECOND!.!D.MS:~0,2!
  %CMD_AFTER%
  goto :eof
  
  