Advertisement
npocmaka

w32time

Apr 29th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. rem -- printing local time with w32tm
  3. rem -- by Vasil "npocmaka" Arnaudov
  4.  
  5. setlocal
  6. for /f "tokens=3,4 delims=^( "  %%T in ('w32tm /stripchart /computer:localhost  /samples:1 /packetinfo /period:1 ^| find "Transmit Timestamp:"') do (
  7.     set HEXx64_Time_Stamp=%%T
  8.     set ANSI_Current_Date=%%U
  9. )
  10.  
  11. call :hexByteRevert %HEXx64_Time_Stamp% test_x46
  12. w32tm /ntpte %test_x46%
  13.  
  14. goto :eof
  15.  
  16. :hexByteRevert [%1 - hex value , %2 - variable to store result in]
  17. setlocal ENABLEDELAYEDEXPANSION
  18. set hex=%~1
  19. set res=%~2
  20. set "temp="
  21. for /L %%L in (2,2,16) do (
  22.      set temp=!hex:~%%L,2!!temp!
  23. )
  24. endlocal & call set %res%=0x%temp%
  25. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement