Latency measurement using C