KSS Utility
C++ general utilities
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
timeutil.hpp File Reference

Miscellaneous algorithms related to time_point and duration objects. More...

#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <istream>
#include <locale>
#include <ostream>
#include <stdexcept>
#include <string>
#include <type_traits>

Go to the source code of this file.

Namespaces

 kss
 All Klassen Software Solutions libraries begin with this namespace.
 
 kss::util
 General utility methods that don't fit into any of the other categories.
 
 kss::util::time
 Items related to parsing, formatting, and manipulating time_point and duration objects.
 

Functions

template<class ToDuration , class Rep , class Period >
ToDuration kss::util::time::checkedDurationCast (const std::chrono::duration< Rep, Period > &dtn)
 
std::string kss::util::time::formatIso8601 (const struct tm &tm) noexcept
 
struct tm & kss::util::time::parseIso8601 (const std::string &timestr, struct tm &tm)
 
template<class Duration >
struct tm & kss::util::time::parseIso8601 (const std::string &timestr, struct tm &tm, Duration &subseconds)
 
std::chrono::milliseconds kss::util::time::timeOfExecution (const std::function< void()> &fn)
 
template<class TimePoint >
TimePoint kss::util::time::now (const TimePoint &=TimePoint())
 
template<class TimePoint >
TimePoint kss::util::time::fromTimeT (time_t t, const TimePoint &=TimePoint())
 
template<class TimePoint >
TimePoint kss::util::time::fromTm (const struct tm &tm, const TimePoint &typeArg=TimePoint())
 
template<class TimePoint >
TimePoint kss::util::time::fromIso8601String (const std::string &s, const TimePoint &typeArg=TimePoint())
 
template<class TimePoint >
TimePoint kss::util::time::fromLocalizedString (const std::string &s, const std::locale &loc=std::locale(), const std::string &tzone=std::string(), const TimePoint &typeArg=TimePoint())
 
template<class Clock , class Duration = typename Clock::duration>
time_t kss::util::time::toTimeT (const std::chrono::time_point< Clock, Duration > &tp)
 
template<class Clock , class Duration = typename Clock::duration>
struct tm & kss::util::time::toTm (const std::chrono::time_point< Clock, Duration > &tp, struct tm &tm)
 
template<class Clock , class Duration = typename Clock::duration>
std::string kss::util::time::toIso8601String (const std::chrono::time_point< Clock, Duration > &tp)
 
template<class Clock , class Duration = typename Clock::duration>
std::string kss::util::time::toLocalizedString (const std::chrono::time_point< Clock, Duration > &tp, const std::locale &loc=std::locale(), const std::string &tzone=std::string())
 
template<class Clock , class Duration = typename Clock::duration>
std::ostream & kss::util::time::operator<< (std::ostream &strm, const std::chrono::time_point< Clock, Duration > &tp)
 
template<class Clock , class Duration = typename Clock::duration>
std::istream & kss::util::time::operator>> (std::istream &strm, std::chrono::time_point< Clock, Duration > &tp)
 

Detailed Description

Miscellaneous algorithms related to time_point and duration objects.

Definition in file timeutil.hpp.