|
111 | 111 | <div class="headertitle"><div class="title">Time Shield Library </div></div> |
112 | 112 | </div><!--header--> |
113 | 113 | <div class="contents"> |
114 | | -<div class="textblock"><p><b>Version:</b> <code>1.0.0</code></p> |
| 114 | +<div class="textblock"><p><b>Version:</b> <code>1.0.1</code></p> |
115 | 115 | <h1><a class="anchor" id="intro_sec"></a> |
116 | 116 | Introduction</h1> |
117 | | -<p>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.</p> |
| 117 | +<p>The Time Shield Library is a comprehensive C++ library designed for time manipulation, formatting, and conversion. It was built for practical and engineering tasks, especially in constrained or performance-critical environments.</p> |
| 118 | +<h1><a class="anchor" id="motivation_sec"></a> |
| 119 | +Why Time Shield?</h1> |
| 120 | +<p>Unlike <code>std::chrono</code> or more academic libraries like <code>HowardHinnant/date</code>, Time Shield is designed to be simple, portable, and suitable for scenarios like logging, serialization, MQL5 usage, and date/time formatting.</p> |
| 121 | +<ul> |
| 122 | +<li>Uses simple types (<code>int64_t</code>, <code>double</code>) like <code>ts_t</code>, <code>fts_t</code> for timestamps — easy to serialize and store.</li> |
| 123 | +<li>Supports multiple time representations: Unix, floating-point seconds, ms/us precision, OLE Automation, Julian dates.</li> |
| 124 | +<li>Includes utilities for rounding, ISO8601 formatting/parsing, time parts, and boundary calculations.</li> |
| 125 | +<li>Header-only and cross-platform; most modules require only STL and <code><cstdint></code>.</li> |
| 126 | +<li>MQL5-compatible — does not use exceptions, STL containers, or dynamic memory.</li> |
| 127 | +<li>Modules requiring platform-specific APIs (like <code>NtpClient</code>) are isolated and optional.</li> |
| 128 | +</ul> |
118 | 129 | <h1><a class="anchor" id="features_sec"></a> |
119 | 130 | Features</h1> |
120 | 131 | <ul> |
121 | 132 | <li>Validation of dates and times</li> |
122 | | -<li>Time and date formatting</li> |
123 | | -<li>Time zone calculations</li> |
124 | | -<li>Conversion between different time representations</li> |
125 | | -<li>Utilities for time manipulation</li> |
| 133 | +<li>Time and date formatting (standard and custom)</li> |
| 134 | +<li>Time zone conversion functions</li> |
| 135 | +<li>ISO8601 string parsing</li> |
| 136 | +<li>Utilities for time manipulation and conversion</li> |
126 | 137 | </ul> |
127 | 138 | <h1><a class="anchor" id="usage_sec"></a> |
128 | | -Usage</h1> |
| 139 | +Example</h1> |
129 | 140 | <div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="time__shield_8hpp.html">time_shield.hpp</a>></span></div> |
130 | 141 | <div class="line"> </div> |
131 | 142 | <div class="line"><span class="keywordtype">int</span> <a class="code hl_function" href="ntp__client__example_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div> |
@@ -154,9 +165,36 @@ <h1><a class="anchor" id="usage_sec"></a> |
154 | 165 | <div class="ttc" id="agroup__time__utils_html_ga450be3ba3ddf294da4c9bc4cd01f8216"><div class="ttname"><a href="group__time__utils.html#ga450be3ba3ddf294da4c9bc4cd01f8216">time_shield::timestamp</a></div><div class="ttdeci">const ts_t timestamp() noexcept</div><div class="ttdoc">Get the current UTC timestamp in seconds.</div><div class="ttdef"><b>Definition</b> <a href="time__utils_8hpp_source.html#l00131">time_utils.hpp:131</a></div></div> |
155 | 166 | <div class="ttc" id="antp__client__example_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="ntp__client__example_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdef"><b>Definition</b> <a href="ntp__client__example_8cpp_source.html#l00055">ntp_client_example.cpp:55</a></div></div> |
156 | 167 | <div class="ttc" id="atime__shield_8hpp_html"><div class="ttname"><a href="time__shield_8hpp.html">time_shield.hpp</a></div><div class="ttdoc">Main header file for the Time Shield library.</div></div> |
157 | | -</div><!-- fragment --><h1><a class="anchor" id="install_sec"></a> |
| 168 | +</div><!-- fragment --><h1><a class="anchor" id="examples_sec"></a> |
| 169 | +Examples</h1> |
| 170 | +<p>Located in the <code>examples/</code> folder:</p> |
| 171 | +<ul> |
| 172 | +<li><code><a class="el" href="time__utils__example_8cpp.html" title="Demonstrates functions from time_shield::time_utils.">time_utils_example.cpp</a></code> — get timestamps and parts</li> |
| 173 | +<li><code><a class="el" href="time__formatting__example_8cpp.html" title="Demonstrates functions from time_shield::time_formatting.">time_formatting_example.cpp</a></code> — to_string, ISO8601, MQL5</li> |
| 174 | +<li><code><a class="el" href="time__parser__example_8cpp.html" title="Demonstrates functions from time_shield::time_parser.">time_parser_example.cpp</a></code> — parse ISO8601</li> |
| 175 | +<li><code><a class="el" href="time__conversions__example_8cpp.html" title="Demonstrates functions from time_shield::time_conversions.">time_conversions_example.cpp</a></code> — convert between formats</li> |
| 176 | +<li><code><a class="el" href="time__zone__conversions__example_8cpp.html" title="Demonstrates functions from time_shield::time_zone_conversions.">time_zone_conversions_example.cpp</a></code> — CET/EET ↔ GMT</li> |
| 177 | +<li><code><a class="el" href="ntp__client__example_8cpp.html" title="Demonstrates usage of time_shield::NtpClient.">ntp_client_example.cpp</a></code> — NTP sync (Windows-only)</li> |
| 178 | +</ul> |
| 179 | +<h1><a class="anchor" id="install_sec"></a> |
158 | 180 | Installation</h1> |
159 | | -<p>To use the Time Shield Library in your project, include the header file <code><a class="el" href="time__shield_8hpp.html" title="Main header file for the Time Shield library.">time_shield.hpp</a></code> in your source code. Ensure that your project is set up to compile with standards from C++11 to C++17.</p> |
| 181 | +<p>Time Shield is a header-only library. To use it in your C++ project:</p> |
| 182 | +<ul> |
| 183 | +<li>Add the <code>include/time_shield_cpp</code> folder to your project's include paths.</li> |
| 184 | +<li>Include the main header:</li> |
| 185 | +</ul> |
| 186 | +<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="time__shield_8hpp.html">time_shield.hpp</a>></span></div> |
| 187 | +</div><!-- fragment --><p>No additional build steps or external dependencies are required.</p> |
| 188 | +<p>For MQL5/MetaTrader:</p> |
| 189 | +<ul> |
| 190 | +<li>Run <code>install_mql5.bat</code> to copy the necessary <code>.mqh</code> files to your MQL5 include directory.</li> |
| 191 | +<li>Include the main file in your MQL5 script:</li> |
| 192 | +</ul> |
| 193 | +<div class="fragment"><div class="line">#include <TimeShield.mqh></div> |
| 194 | +</div><!-- fragment --><p>To build the C++ examples:</p> |
| 195 | +<ul> |
| 196 | +<li>Run <code>build-examples.bat</code> to compile example programs with MSVC or your preferred toolchain.</li> |
| 197 | +</ul> |
160 | 198 | <h1><a class="anchor" id="repo_sec"></a> |
161 | 199 | Repository</h1> |
162 | 200 | <p><a href="https://github.com/NewYaroslav/time-shield-cpp">Time Shield Library GitHub repository</a></p> |
|
0 commit comments