Introduction
The Time Shield Library is a comprehensive C++ library designed for time manipulation, formatting, and conversion. This library aims to provide a robust and flexible set of tools for handling various time-related tasks with ease.
Features
- Validation of dates and times
- Time and date formatting
- Time zone calculations
- Conversion between different time representations
- Utilities for time manipulation
Usage
#include <iostream>
int main() {
std::cout << "Days until end of year: " << days << std::endl;
std::cout << "Error occurred while parsing ISO8601 string" << std::endl;
return -1;
}
std::cout << "Future time: " << formatted_time << std::endl;
return 0;
}
int64_t ts_t
Integer timestamp type.
int64_t ts_ms_t
Integer timestamp milliseconds type.
const bool str_to_ts_ms(const std::string &str, ts_ms_t &ts)
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
constexpr const T get_days_difference(const ts_t &start, const ts_t &stop) noexcept
Get the number of days between two timestamps.
const std::string to_iso8601_utc_str_ms(const ts_ms_t &ts_ms)
Converts a timestamp in milliseconds to an ISO8601 string in UTC format.
const ts_t timestamp() noexcept
Get the current UTC timestamp in seconds.
TIME_SHIELD_CONSTEXPR ts_t end_of_year(const ts_t &ts=ts())
Get the end-of-year timestamp.
const std::string to_iso8601_str(const T &ts)
Converts a timestamp to an ISO8601 string.
Main header file for the Time Shield library.
Installation
To use the Time Shield Library in your project, include the header file time_shield.hpp
in your source code. Ensure that your project is set up to compile with standards from C++11 to C++17.
Repository
Time Shield Library GitHub repository.
License
This library is licensed under the MIT License. See the LICENSE file for more details.