A library for working with phylogenetic and population genetic data.
v0.27.0
date_time.hpp File Reference

Detailed Description

Provides functions for date and time access.

Definition in file date_time.hpp.

#include <ctime>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

template<typename ForwardIterator >
std::vector< std::tm > convert_to_tm (ForwardIterator first, ForwardIterator last, size_t size=0)
 Convert a list of std::string to std::tm date/time objects, if possible. Throw otherwise. More...
 
template<typename ForwardIterator >
std::vector< std::tm > convert_to_tm (ForwardIterator first, ForwardIterator last, std::string const &format, size_t size=0)
 Convert a list of std::string to std::tm date/time objects, if possible. Throw otherwise. More...
 
template<typename ForwardIterator >
std::vector< std::tm > convert_to_tm (ForwardIterator first, ForwardIterator last, std::string const &format, std::string const &locale, size_t size=0)
 Convert a list of std::string to std::tm date/time objects, if possible. Throw otherwise. More...
 
std::tm convert_to_tm (std::string const &str)
 Convert a std::string to a std::tm date/time object, if possible. Throw otherwise. More...
 
std::tm convert_to_tm (std::string const &str, std::string const &format)
 Convert a std::string to a std::tm date/time object, if possible. Throw otherwise. More...
 
std::tm convert_to_tm (std::string const &str, std::string const &format, std::string const &locale)
 Convert a std::string to a std::tm date/time object, if possible. Throw otherwise. More...
 
std::string current_date ()
 Returns the current date as a string in the format "2014-12-31". More...
 
std::string current_time ()
 Returns the current time as a string in the format "13:37:42". More...
 
template<typename ForwardIterator >
bool is_convertible_to_tm (ForwardIterator first, ForwardIterator last)
 Return whether a list of std::string is convertible to std::tm date/time objects. More...
 
template<typename ForwardIterator >
bool is_convertible_to_tm (ForwardIterator first, ForwardIterator last, std::string const &format)
 Return whether a list of std::string is convertible to std::tm date/time objects. More...
 
template<typename ForwardIterator >
bool is_convertible_to_tm (ForwardIterator first, ForwardIterator last, std::string const &format, std::string const &locale)
 Return whether a list of std::string is convertible to std::tm date/time objects. More...
 
bool is_convertible_to_tm (std::string const &str)
 Return whether a std::string is convertible to a std::tm date/time object, that is, whether it contains a date/time in a recognizable format. More...
 
bool is_convertible_to_tm (std::string const &str, std::string const &format)
 Return whether a std::string is convertible to a std::tm date/time object, that is, whether it contains a date/time in a recognizable format. More...
 
bool is_convertible_to_tm (std::string const &str, std::string const &format, std::string const &locale)
 Return whether a std::string is convertible to a std::tm date/time object, that is, whether it contains a date/time in a recognizable format. More...
 
template<typename ForwardIterator >
std::vector< std::tm > time_to_tm (ForwardIterator first, ForwardIterator last, bool use_local_time=false, size_t size=0)
 Convert a list of std::time_t objects to a std::vector of std::tm objects. More...
 
std::tm time_to_tm (std::time_t const &time, bool use_local_time=false)
 Convert std::time_t object to a std::tm object. More...
 
std::vector< std::tm > time_to_tm (std::vector< std::time_t > const &times, bool use_local_time=false)
 Convert a std::vector of std::time_t objects to a std::vector of std::tm objects. More...
 
std::string tm_date_to_string (std::tm const &time)
 Print the given std::tm object as a std::string containing only the date, using the ISO 8601 extended format. More...
 
std::string tm_time_to_string (std::tm const &time)
 Print the given std::tm object as a std::string containing only the time, using the ISO 8601 extended format. More...
 
std::string tm_to_string (std::tm const &time)
 Print the given std::tm object as a std::string, using the ISO 8601 extended format. More...
 
std::string tm_to_string (std::tm const &time, std::string const &format)
 Print the given std::tm object as a std::string, using the format. More...
 
std::string tm_to_string (std::tm const &time, std::string const &format, std::string const &locale)
 Print the given std::tm object as a std::string, using the format and locale. More...
 
template<typename ForwardIterator >
std::vector< std::time_t > tm_to_time (ForwardIterator first, ForwardIterator last, bool use_local_time=false, size_t size=0)
 Convert a list of std::tm objects to a std::vector of std::time_t objects. More...
 
std::time_t tm_to_time (std::tm time, bool use_local_time=false)
 Convert std::tm object to a std::time_t object. More...
 
std::vector< std::time_t > tm_to_time (std::vector< std::tm > const &times, bool use_local_time=false)
 Convert a std::vector of std::tm objects to a std::vector of std::time_t objects. More...