I've used this Code with Mono on a Raspberry Pi but it doesn't work. The same Code works with Visual Studio on Windows. On Windows i get "NTP OK" and on the Raspberry I get "NTP ERORR".
public static void CheckTimeOK()
{
var client = new Yort.Ntp.NtpClient("130.149.17.21");
client.TimeReceived += Client_TimeReceived;
client.ErrorOccurred += Client_ErrorOccurred;
client.BeginRequestTime();
}
public static void Client_ErrorOccurred(object sender, NtpNetworkErrorEventArgs e)
{
Console.WriteLine("NTP ERROR");
}
public static void Client_TimeReceived(object sender, NtpTimeReceivedEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.CurrentTime);
Console.WriteLine("NTP ok");
}