2019-08-08 22:13:06 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2019-07-28 02:30:30 +02:00
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=9" / >
2019-08-08 22:13:06 +02:00
< meta name = "generator" content = "Doxygen 1.8.15" / >
2019-07-28 02:30:30 +02:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
2019-08-05 22:01:08 +02:00
< title > remwharead: include/time.hpp File Reference< / title >
2019-07-28 02:30:30 +02:00
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr style = "height: 56px;" >
< td id = "projectalign" style = "padding-left: 0.5em;" >
< div id = "projectname" > remwharead
2019-09-22 03:46:49 +02:00
  < span id = "projectnumber" > 0.8.3< / span >
2019-07-28 02:30:30 +02:00
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2019-08-08 22:13:06 +02:00
<!-- Generated by Doxygen 1.8.15 -->
2019-07-28 02:30:30 +02:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
< / script >
< script type = "text/javascript" src = "menudata.js" > < / script >
< script type = "text/javascript" src = "menu.js" > < / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */< / script >
< div id = "main-nav" > < / div >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< iframe src = "javascript:void(0)" frameborder = "0"
name="MSearchResults" id="MSearchResults">
< / iframe >
< / div >
< div id = "nav-path" class = "navpath" >
< ul >
2019-08-05 22:01:08 +02:00
< li class = "navelem" > < a class = "el" href = "dir_d44c64559bbebec7f509842c48db8b23.html" > include< / a > < / li > < / ul >
2019-07-28 02:30:30 +02:00
< / div >
< / div > <!-- top -->
< div class = "header" >
< div class = "summary" >
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" >
< div class = "title" > time.hpp File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< div class = "textblock" > < code > #include < string> < / code > < br / >
< code > #include < chrono> < / code > < br / >
< / div >
< p > < a href = "time_8hpp_source.html" > Go to the source code of this file.< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:ad6942f485c7b34b97451c50cadc9c4f8" > < td class = "memItemLeft" align = "right" valign = "top" > const time_point  < / td > < td class = "memItemRight" valign = "bottom" > < b > remwharead::string_to_timepoint< / b > (const string & strtime, bool sqlite=false)< / td > < / tr >
< tr class = "memdesc:ad6942f485c7b34b97451c50cadc9c4f8" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Convert ISO 8601 or SQLite time-string to time_point. < a href = "time_8cpp.html#ad6942f485c7b34b97451c50cadc9c4f8" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ad6942f485c7b34b97451c50cadc9c4f8" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:afe40ba8b39335c4196c1b12139014e7d" > < td class = "memItemLeft" align = "right" valign = "top" > const string  < / td > < td class = "memItemRight" valign = "bottom" > < b > remwharead::timepoint_to_string< / b > (const time_point & tp, bool sqlite=false)< / td > < / tr >
< tr class = "memdesc:afe40ba8b39335c4196c1b12139014e7d" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Convert time_point to ISO 8601 or SQLite time-string. < a href = "time_8cpp.html#afe40ba8b39335c4196c1b12139014e7d" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:afe40ba8b39335c4196c1b12139014e7d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< h2 class = "groupheader" > Function Documentation< / h2 >
< a id = "file_ad6942f485c7b34b97451c50cadc9c4f8" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#file_ad6942f485c7b34b97451c50cadc9c4f8" > ◆ < / a > < / span > string_to_timepoint()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > const time_point remwharead::string_to_timepoint < / td >
< td > (< / td >
< td class = "paramtype" > const string &   < / td >
< td class = "paramname" > < em > strtime< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > bool  < / td >
< td class = "paramname" > < em > sqlite< / em > = < code > false< / code >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Convert ISO 8601 or SQLite time-string to time_point. < / p >
< p > The SQLite format is < em > YY-MM-DD hh:mm:ss< / em > instead of < em > YY-MM-DDThh:mm:ss< / em > .< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > strtime< / td > < td > Time string in ISO 8601 or SQLite format. < / td > < / tr >
< tr > < td class = "paramname" > sqlite< / td > < td > Is the string in SQLite format? < / td > < / tr >
< / table >
< / dd >
< / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00026" > < / a > < span class = "lineno" > 26< / span >   {< / div > < div class = "line" > < a name = "l00027" > < / a > < span class = "lineno" > 27< / span >   std::stringstream sstime(strtime);< / div > < div class = "line" > < a name = "l00028" > < / a > < span class = "lineno" > 28< / span >   < span class = "keyword" > struct < / span > std::tm tm = {};< / div > < div class = "line" > < a name = "l00029" > < / a > < span class = "lineno" > 29< / span >   tm.tm_isdst = -1; < span class = "comment" > // Detect daylight saving time.< / span > < / div > < div class = "line" > < a name = "l00030" > < / a > < span class = "lineno" > 30< / span >   < span class = "keywordflow" > if< / span > (sqlite)< / div > < div class = "line" > < a name = "l00031" > < / a > < span class = "lineno" > 31< / span >   {< / div > < div class = "line" > < a name = "l00032" > < / a > < span class = "lineno" > 32< / span >   sstime > > std::get_time(& tm, < span class = "stringliteral" > " %Y-%m-%d %T" < / span > );< / div > < div class = "line" > < a name = "l00033" > < / a > < span class = "lineno" > 33< / span >   }< / div > < div class = "line" > < a name = "l00034" > < / a > < span class = "lineno" > 34< / span >   < span class = "keywordflow" > else< / span > < / div > < div class = "line" > < a name = "l00035" > < / a > < span class = "lineno" > 35< / span >   {< / div > < div class = "line" > < a name = "l00036" > < / a > < span class = "lineno" > 36< / span >   sstime > > std::get_time(& tm, < span class = "stringliteral" > " %Y-%m-%dT%T" < / span > );< / div > < div class = "line" > < a name = "l00037" > < / a > < span class = "lineno" > 37< / span >   }< / div > < div class = "line" > < a name = "l00038" > < / a > < span class = "lineno" > 38< / span >   std::time_t time = timelocal(& tm); < span class = "comment" > // Assume time is local.< / span > < / div > < div class = "line" > < a name = "l00039" > < / a > < span class = "lineno" > 39< / span >   < span class = "keywordflow" > return< / span > system_clock::from_time_t(time);< / div > < div class = "line" > < a name = "l00040" > < / a > < span class = "lineno" > 40< / span >   }< / div > < / div > <!-- fragment -->
< / div >
< / div >
< a id = "file_afe40ba8b39335c4196c1b12139014e7d" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#file_afe40ba8b39335c4196c1b12139014e7d" > ◆ < / a > < / span > timepoint_to_string()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > const string remwharead::timepoint_to_string < / td >
< td > (< / td >
< td class = "paramtype" > const time_point &   < / td >
< td class = "paramname" > < em > tp< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > bool  < / td >
< td class = "paramname" > < em > sqlite< / em > = < code > false< / code >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Convert time_point to ISO 8601 or SQLite time-string. < / p >
< p > The SQLite format is < em > YY-MM-DD hh:mm:ss< / em > instead of < em > YY-MM-DDThh:mm:ss< / em > .< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > time_point< / td > < td > The std::chrono::system_clock::time_point. < / td > < / tr >
< tr > < td class = "paramname" > sqlite< / td > < td > Is the string in SQLite format? < / td > < / tr >
< / table >
< / dd >
< / dl >
2019-08-08 22:13:06 +02:00
< div class = "fragment" > < div class = "line" > < a name = "l00043" > < / a > < span class = "lineno" > 43< / span >   {< / div > < div class = "line" > < a name = "l00044" > < / a > < span class = "lineno" > 44< / span >   constexpr std::uint16_t bufsize = 32;< / div > < div class = "line" > < a name = "l00045" > < / a > < span class = "lineno" > 45< / span >   std::time_t time = system_clock::to_time_t(tp);< / div > < div class = "line" > < a name = "l00046" > < / a > < span class = "lineno" > 46< / span >   std::tm *tm;< / div > < div class = "line" > < a name = "l00047" > < / a > < span class = "lineno" > 47< / span >   tm = std::localtime(& time);< / div > < div class = "line" > < a name = "l00048" > < / a > < span class = "lineno" > 48< / span >   < / div > < div class = "line" > < a name = "l00049" > < / a > < span class = "lineno" > 49< / span >   < span class = "keywordtype" > char< / span > buffer[bufsize];< / div > < div class = "line" > < a name = "l00050" > < / a > < span class = "lineno" > 50< / span >   < span class = "keywordflow" > if< / span > (sqlite)< / div > < div class = "line" > < a name = "l00051" > < / a > < span class = "lineno" > 51< / span >   {< / div > < div class = "line" > < a name = "l00052" > < / a > < span class = "lineno" > 52< / span >   std::strftime(buffer, bufsize, < span class = "stringliteral" > " %F %T" < / span > , tm);< / div > < div class = "line" > < a name = "l00053" > < / a > < span class = "lineno" > 53< / span >   }< / div > < div class = "line" > < a name = "l00054" > < / a > < span class = "lineno" > 54< / span >   < span class = "keywordflow" > else< / span > < / div > < div class = "line" > < a name = "l00055" > < / a > < span class = "lineno" > 55< / span >   {< / div > < div class = "line" > < a name = "l00056" > < / a > < span class = "lineno" > 56< / span >   std::strftime(buffer, bufsize, < span class = "stringliteral" > " %FT%T" < / span > , tm);< / div > < div class = "line" > < a name = "l00057" > < / a > < span class = "lineno" > 57< / span >   }< / div > < div class = "line" > < a name = "l00058" > < / a > < span class = "lineno" > 58< / span >   < / div > < div class = "line" > < a name = "l00059" > < / a > < span class = "lineno" > 59< / span >   < span class = "keywordflow" > return< / span > static_cast< const string> (buffer);< / div > < div class = "line" > < a name = "l00060" > < / a > < span class = "lineno" > 60< / span >   }< / div > < / div > <!-- fragment -->
2019-07-28 02:30:30 +02:00
< / div >
< / div >
< / div > <!-- contents -->
<!-- start footer part -->
< hr class = "footer" / > < address class = "footer" > < small >
Generated by   < a href = "http://www.doxygen.org/index.html" >
< img class = "footer" src = "doxygen.png" alt = "doxygen" / >
2019-08-08 22:13:06 +02:00
< / a > 1.8.15
2019-07-28 02:30:30 +02:00
< / small > < / address >
< / body >
< / html >