jbenet / ios-ntp

SNTP implementation for iOS
http://code.google.com/p/ios-ntp/
MIT License
370 stars 112 forks source link

Changed the return value of -[NetworkClock networkOffset] to <SERVER_… #27

Closed adammurnane closed 6 years ago

adammurnane commented 9 years ago

I am certain that this change is actually what was intended. If I'm incorrect about that please let me know.

gavineadie commented 9 years ago

Why make a change like this which requires any caller of this method to change their code ?

adammurnane commented 9 years ago

The method directly underneath, -[NetworkClock networkTime], is supposed to return a NSDate object which is equal to the network time. With the current implementation of networkOffset, that is not the case. I looked at the history and noticed that prior calculations for the timeInterval did negate it. See https://github.com/jbenet/ios-ntp/commit/c6f2d2b7054e8f8e1bf2110ec7e384ac0e1c21da

adammurnane commented 9 years ago

Perhaps it might be better to negate the value returned by networkOffset in the networkTime method itself, that would also correct the issue and networkOffset would still return the same thing.