Here is my method:
Code:
on *:CTCPREPLY:ping *:{
  echo $color(ctcp) -at [ $+ $nick $1 reply]: $calc($ticks - $2) ms
  haltdef
}
alias ctcp {
  if ( $2 == ping ) {
    echo $color(ctcp) -at -> $chr(91) $+ $1 $+ $chr(93) PING
    .msg $1 PING $ticks $+ 
  }
  else { !ctcp $1- }
}