Avatar of kpdonahue
kpdonahueFlag for United States of America

asked on 

ping command timestamp

I am attempting to monitor a connection to my terminal sever and am using the command:
ping -t terminalsvr -s 1 > c:\pingfile.txt to capture the ping results.
Here is a sample of what I receive:
Pinging terminalsvr [192.168.10.19] with 32 bytes of data:
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 1825398531
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 1154572035
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 752180995
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 349789955
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 4242300675
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 3839909635
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 3437518595
Reply from 192.168.10.19: bytes=32 time<10ms TTL=128
Timestamp: 192.168.10.19 : 3035127555
Ping statistics for 192.168.10.19:
Packets: Sent = 8, Received = 8, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum =  0ms, Average =  0ms
Control-C

How is the timestamp read?  Is there a way for me to have the timestamp appears as the actual time on the pc?

thanks all
Microsoft DOS

Avatar of undefined
Last Comment
SteveGTR
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

When I ran the ping against some of our machines the timestamp value was much smaller and it was in ascending order. Yours are all over the place and very large. In my case the current time is around 11:30 AM and the timestamp value I get is  59818406. My understanding is that this is the number of ticks since midnight. I wrote the code below to convert ticks to time:

@echo off

setlocal

call :TICK2TIME t 59818406

echo time: %t%

goto :EOF

:TICK2TIME

set /a _h=%~2 / 1440 / 60 / 60
set /a _m=(%~2 / 1440 / 60) %% 60
set /a _s=(%~2 / 1440) %% 60

call :ZEROPAD _h %_h%
call :ZEROPAD _m %_h%
call :ZEROPAD _s %_h%

set %1=%_h%:%_m%:%_s%

goto :EOF

:ZEROPAD

if /I %~2 LSS 10 set %~1=0%~2

goto :EOF

Good Luck,
Steve
Avatar of kpdonahue
kpdonahue
Flag of United States of America image

ASKER

how do I use this code?
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft DOS
Microsoft DOS

Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.

14K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo