Code Monkey home page Code Monkey logo

yort.ntp's Introduction

Yort.Ntp.Portable

A cross platform NTP client library for .Net platforms. Allows you to easily retrieve an accurate, current date & time from internet NTP servers.

GitHub license

Supported Platforms

Currently;

  • .Net Framework 4.0+
  • .Net Framework 4.5+ **
  • Windows Phone Silverlight (8.1+)
  • Xamarin.iOS **
  • Xamarin.Android **
  • WinRT (Windows Store Apps 8.1) **
  • UWP 10+ (Windows 10 Universal Programs) **
  • .Net Standard 1.3

** Supports async/await

Build Status

Build status

Available on Nuget

    PM> Install-Package Yort.Ntp.Portable

NuGet Badge

Samples

For platforms that support task based async;

var client = new Yort.Ntp.NtpClient();
var currentTime = await client.RequestTimeAsync();

For platforms that do not support async/await or tasks (or if you don't want to use async/await);

var client = new Yort.Ntp.NtpClient();
client.TimeReceived += Client_TimeReceived;
client.ErrorOccurred += Client_ErrorOccurred;
client.BeginRequestTime();

private void Client_ErrorOccurred(object sender, NtpNetworkErrorEventArgs e)
{
	//TODO: Handle errors here.
}

private void Client_TimeReceived(object sender, NtpTimeReceivedEventArgs e)
{
    //TODO: Use retrieved time here. Time is provided by e.CurrentTime.
	System.Diagnostics.Debug.WriteLine(e.CurrentTime);
}

Attributions

The icon for this project is Computer Time by Arthur Shlain from the Noun Project and is used under the Creative Commons License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.