views:

40

answers:

3

Hi,

I'm trying to be fair play in my network game and I would like to mark as winner the player who won first and it depends on time but DateTime.Now is local time and both computers may have set different times on their machines.

Is there something that .NET provides for this case?

Thanks!

+2  A: 

Normally you would base this on server time, otherwise it can(will) be spoofed by cheaters.

BioBuckyBall
+2  A: 

If you need to check who was first to finish some task or something I would suggest you to use some kind of timer. For example you can use StopWatch. However if the machine time is essential for the application the only reliable time in your case is server time, so you can work only with it.

Incognito
It's much better. Thank you!
MartyIX
+1  A: 

If there is no server involved why don't you get the time difference of machines and then add/subtract accordingly for the "other computer"'s time?

TheCloudlessSky