Skip to content

systelab/cpp-time-adapter

Repository files navigation

Build Status Build status codecov Codacy Badge

C++ Time Adapter Library

This library provides utilities to access system time.

Setup

Download using Conan

This library is designed to be installed by making use of Conan package manager. So, you just need to add the following requirement into your Conan recipe:

def requirements(self):
   self.requires("TimeAdapter/1.0.0@systelab/stable")

Version number of this code snipped is set just as an example. Replace it for the desired package version to retrieve.

As this package is not available on the conan-center, you will also need to configure a remote repository before installing dependencies:

conan remote add systelab-public https://systelab.jfrog.io/artifactory/api/conan/cpp-conan-production-local

See Conan documentation for further details on how to integrate this package with your build system.

Build from sources

See BUILD.md document for details.

Usage

Current time

The current time (in UTC) can be retrieved using an instance of systelab::time::ITimeAdapter as follows:

#include "TimeAdapter/ITimeAdapter.h"

systelab::time::ITimeAdapter& timeAdapter = ...
std::chrono::system_clock::time_point currentUTCTime = timeAdapter.getCurrentUTCTime();