-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If i change the time into the future,it will be fail #13
Comments
I can verify that if the "device time" is set manually to a time in the future, the "network time" is incorrectly reported to be the same as the device time. I'll take a look at this, though the use case seems unlikely. |
Not so unlikely: the reason i first grabbed this lib was to prevent cheating from players in a game that required accurate time. |
Good point! I'll raise my priority, and raise my suspicion levels !! |
Found it. One of the checks for whether a time server's time should be used or ignored is that the server's time should have been set during the previous hour. That hour is, incorrectly, measured from the client's time so if you advance the client's time by more than one hour, ALL the servers will treated as invalid because their last time setting cannot possible be less than one hour before the client's time. This mistake has been in my code for ever. I will fix it in the next few days .. |
This is fixed. |
I want to restructure the way the library works. The "NetAssociation" class does too much work just now; not only does it bounce requests off a time server, it also manages the averaging of multiple time values that are returned. I would like to change this so that this class obtains one time value from one server, nothing more. This simple, function is not available in the present library which defeats a common use - quickly (~1 second) deriving a moderately accurate time. The use of multiple time sources and multiple time samples from each source takes longer but provides more accurate time - it is commonly used in continuously running daemon or server implementations where the time required to select the most accurate servers from a pool and then consolidate their times is no hinderance. That sophisticated ability can be retained in the "NetworkClock" class where it would use the "NetAssociation" class to get the necessary samples. Is this an improvement? |
@gavineadie Yes! |
When i change the device time into the future,
the networkDate doing nothing.
The text was updated successfully, but these errors were encountered: