#include <Date.au3>
Local $sOutput = '', $sDate = _NowCalcDate()
$iPID = Run(@comspec & ' /C w32tm /stripchart /computer:ntp2.stratum1.ru /samples:1 /dataonly', '' , @SW_HIDE, 9)
Local $sOutput, $last
Do
$sOutput &= StdoutRead($iPID)
If @error Then ; Выход из цикла, если процесс завершён или StdoutRead возвращает ошибку.
ExitLoop
EndIf
Until StringRight($sOutput, 1) = ">" Or StringRight($sOutput, 2) = "? "
;~ ConsoleWrite($sOutput & @CRLF)
$arr = StringRegExpReplace($sOutput, '(\d\d?).(\d\d?).(\d\d\d\d)( \d\d?:\d\d:\d\d)', '$3/$2/$1$4')
$arr = StringRegExpReplace($arr, '(?m)^(\d\d?:\d\d:\d\d)', _NowCalcDate() & ' $1')
;~ ConsoleWrite($arr & @CRLF)
$arr = StringRegExp($arr, '\d\d\d\d/\d\d?/\d\d? \d\d?:\d\d:\d\d', 3)
ConsoleWrite( $arr[0] & @CRLF)
ConsoleWrite( $arr[1] & @CRLF)
ConsoleWrite(_DateDiff('s', $arr[0], $arr[1]) & @CRLF)