|
Time Shield Library 2.0.0
C++ library for working with time
|
This document defines the supported integration contract for consuming Time Shield as a header-only dependency.
English is the canonical version of this document.
Russian localization:
docs/library-integration-guidelines-RU.mdTime Shield is a header-only library. The normal supported integration paths are:
find_package(TimeShield CONFIG REQUIRED)add_subdirectory(...)Link the exported target when CMake is available:
It is valid for multiple static libraries in the same final program to depend on time_shield::time_shield.
This does not create a source-duplication problem as long as consumers:
.cpp filesNtpTimeService is header-only and supports C++11, C++14, and C++17.
C++17+ allows a simpler singleton-storage pattern with inline variables, and the public usage contract for NtpTimeService is the same in C++11/C++14/C++17When TIME_SHIELD_ENABLE_NTP_CLIENT=ON on Windows, the NTP stack requires the platform socket system library.
Supported behavior:
time_shield::time_shield, the required Windows socket library is linked transitivelyws2_32)Do not mix incompatible compile-time configuration for the same final program.
In particular:
TIME_SHIELD_ENABLE_NTP_CLIENT is enabledTIME_SHIELD_ENABLE_LEGACY_ALIASES is enabledBefore finalizing integration, verify:
time_shield::time_shield through CMake when possibleNtpTimeService is used without ownership macros or a special owning TU