|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_TOOLS_DATE_TIME_H_
2 #define GENESIS_UTILS_TOOLS_DATE_TIME_H_
61 std::time_t
tm_to_time( std::tm time,
bool use_local_time =
false );
69 std::vector<std::time_t>
tm_to_time( std::vector<std::tm>
const& times,
bool use_local_time =
false );
79 template<
typename ForwardIterator>
81 ForwardIterator first,
83 bool use_local_time =
false,
87 std::vector<std::time_t> ret;
91 while( first != last ) {
92 ret.push_back(
tm_to_time( *first, use_local_time ));
104 std::tm
time_to_tm( std::time_t
const& time,
bool use_local_time =
false );
112 std::vector<std::tm>
time_to_tm( std::vector<std::time_t>
const& times,
bool use_local_time =
false );
122 template<
typename ForwardIterator>
124 ForwardIterator first,
125 ForwardIterator last,
126 bool use_local_time =
false,
130 std::vector<std::tm> ret;
134 while( first != last ) {
135 ret.push_back(
time_to_tm( *first, use_local_time ));
154 std::string
tm_to_string( std::tm
const& time, std::string
const& format, std::string
const& locale );
161 std::string
tm_to_string( std::tm
const& time, std::string
const& format );
202 std::tm
convert_to_tm( std::string
const& str, std::string
const& format, std::string
const& locale );
215 std::tm
convert_to_tm( std::string
const& str, std::string
const& format );
259 template<
typename ForwardIterator>
261 ForwardIterator first,
262 ForwardIterator last,
263 std::string
const& format,
264 std::string
const& locale,
268 std::vector<std::tm> ret;
272 while( first != last ) {
286 template<
typename ForwardIterator>
288 ForwardIterator first,
289 ForwardIterator last,
290 std::string
const& format,
294 std::vector<std::tm> ret;
298 while( first != last ) {
313 template<
typename ForwardIterator>
315 ForwardIterator first,
316 ForwardIterator last,
320 std::vector<std::tm> ret;
324 while( first != last ) {
337 bool is_convertible_to_tm( std::string
const& str, std::string
const& format, std::string
const& locale );
360 template<
typename ForwardIterator>
362 ForwardIterator first,
363 ForwardIterator last,
364 std::string
const& format,
365 std::string
const& locale
368 while( first != last ) {
382 template<
typename ForwardIterator>
384 ForwardIterator first,
385 ForwardIterator last,
386 std::string
const& format
389 while( first != last ) {
404 template<
typename ForwardIterator>
406 ForwardIterator first,
410 while( first != last ) {
422 #endif // include guard
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.
std::string current_date()
Returns the current date as a string in the format "2014-12-31".
std::string current_time()
Returns the current time as a string in the format "13:37:42".
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...
std::tm time_to_tm(std::time_t const &time, bool use_local_time)
Convert std::time_t object to a std::tm object.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::time_t tm_to_time(std::tm time, bool use_local_time)
Convert std::tm object to a std::time_t object.
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...
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.
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,...