NodaTime get time offset

I have Xamarin PCL project and I added NuGet package "NodaTime".

Especially I want to get difference of windows server time and my device time. Bu I couldn't find anything about this.

Jon Skeet
people
quotationmark

Well Noda Time doesn't have any kind of server-based functionality - and even if it did, that would be likely to be NTP. Matt Johnson has a separate NodaTime.NetworkClock package, which is an IClock implementation for NTP.

Now, does your server act as an NTP server? If not, it's likely you'll need something else.

It's not clear what your server is actually doing, but if you're able to add a "get current time" API, that could help... but you'd need to do a lot of work if you wanted to try to account for network latency. It would be fine for checking whether your device was minutes / hours out, of course.

All of this is assuming that what you're interested in is knowing whether the system clock itself is skewed. If you're just interested in the time zone offset from UTC, that's a different matter - ideally, you'd just find out the time zone of your Windows Server as well. Admittedly detecting the local time zone can be somewhat unreliable - Xamarin used to have issues with TimeZoneInfo.Local, where those issues depended on device platform, but it's possible the situation is better now.

people

See more on this question at Stackoverflow