I'm writing udp multicast datagrams receiver.
If I receive datagram with number X and datagram "X-1" still not received I should wait for 5 ms (because UDP doesn't garantee order of packets) and if datagram "X-1" still not received I should recover.
How to do that? I want to store for each received packet in array the "timestamp" when packet is received. later I want to compare current time with timestamp, and if difference is more than 5 ms and packet X-1 is missing I should recover.
Probably you can suggest another algorithm?
Or if mine is fine how can I convert "current time" to "int" or "long" milliseconds? I don't want to use DateTime.Now
object because it contains a lot of garbage I don't need and I need to do this processing several thousands times per second.