Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Last active August 29, 2015 14:06
Show Gist options
  • Save changtimwu/52ca587a7d757ffe4b5d to your computer and use it in GitHub Desktop.
Save changtimwu/52ca587a7d757ffe4b5d to your computer and use it in GitHub Desktop.
PTP status api json structure

API ptp::get_ptp_status

[
 {
   no: 6  # Arrival Port 
   clockId: "0040c7fffe1c6fce"  # Clock ID
   corrections:  [               # Corrections
     { 
       no:5         # Departure Port
       val: 2345667  # nanosecord
     }
   ]
   seqId: 1  # Sequence ID 
   sourcePort: 7  # Source Port 
   tsnsec: 648549892  # Timestamp second
   tssec: 1397196494  # Timestamp nansecond
 }
]

how to show timestamp( tssec, tssec)

timecap = (ptp)->
  d = new Date(ptp.tssec*1000+ptp.tsnsec/1000)
  d.toISOString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment