/ex_clock_bound_client

AWS clock bound service client in elixir.

Primary LanguageElixirMIT LicenseMIT

ExClockBoundClient

Hex.pm Version Hex.pm License

This is the elixir version of aws clock bound client, to communicate with this service.

Preparation

Make sure the service is running correctly.

Installation

By adding ex_clock_bound_client to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_clock_bound_client, "~> 0.0.1"}
  ]
end

Usage

Runtime Configurations

All configurations are runtime configuration, and have default values.

import Config

config :ex_clock_bound_client,
  clock_bound_socket_path: "/run/clockboundd/clockboundd.sock",
  client_socket_path: Path.expand("./client.sock"),
  recv_timeout: 100, # socket recv timeout
  frequency_error: 1 # Setting clock frequency to 1ppm to match chrony

APIs

There are 5 APIs in this library, and additional deviation/0 are added compared to the official client.

  • ExCloudBoundClient.now/0
  • ExCloudBoundClient.timing/1
  • ExCloudBoundClient.deviation/0
  • ExCloudBoundClient.before?/1
  • ExCloudBoundClient.after?/1

See t:ExClockBoundClient for details.

Todo

This application is just implement a happy path, all exceptions need to be considered.