Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
time_conversion_aliases.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2#pragma once
3#ifndef _TIME_SHIELD_TIME_CONVERSIONS_ALIASES_HPP_INCLUDED
4#define _TIME_SHIELD_TIME_CONVERSIONS_ALIASES_HPP_INCLUDED
5
12
13#include <string>
14
15namespace time_shield {
16
19
22 template<class T = year_t>
23 constexpr T unix_year(ts_t ts) noexcept {
24 return get_unix_year<T>(ts);
25 }
26
29 template<class T = year_t>
30 constexpr T to_unix_year(ts_t ts) noexcept {
31 return get_unix_year<T>(ts);
32 }
33
34//------------------------------------------------------------------------------
35
36
39 template<class T = uday_t>
40 constexpr T get_unixday(ts_t ts = time_shield::ts()) noexcept {
41 return get_unix_day<T>(ts);
42 }
43
44
47 template<class T = uday_t>
48 constexpr T unix_day(ts_t ts = time_shield::ts()) noexcept {
49 return get_unix_day<T>(ts);
50 }
51
52
55 template<class T = uday_t>
56 constexpr T unixday(ts_t ts = time_shield::ts()) noexcept {
57 return get_unix_day<T>(ts);
58 }
59
60
63 template<class T = uday_t>
64 constexpr T uday(ts_t ts = time_shield::ts()) noexcept {
65 return get_unix_day<T>(ts);
66 }
67
68//------------------------------------------------------------------------------
69
70
73 template<class T = uday_t>
74 constexpr T get_unixday_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
75 return get_unix_day_ms<T>(t_ms);
76 }
77
78
81 template<class T = uday_t>
82 constexpr T unix_day_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
83 return get_unix_day_ms<T>(t_ms);
84 }
85
86
89 template<class T = uday_t>
90 constexpr T unixday_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
91 return get_unix_day_ms<T>(t_ms);
92 }
93
94
97 template<class T = uday_t>
98 constexpr T uday_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
99 return get_unix_day_ms<T>(t_ms);
100 }
101
102//------------------------------------------------------------------------------
103
106 template<class T = ts_t>
107 constexpr T unix_day_to_ts(uday_t unix_day) noexcept {
109 }
110
113 template<class T = ts_t>
114 constexpr T unixday_to_ts(uday_t unix_day) noexcept {
116 }
117
120 template<class T = ts_t>
121 constexpr T uday_to_ts(uday_t unix_day) noexcept {
123 }
124
127 template<class T = ts_t>
130 }
131
132//------------------------------------------------------------------------------
133
136 template<class T = ts_t>
137 constexpr T unix_day_to_ts_ms(uday_t unix_day) noexcept {
139 }
140
143 template<class T = ts_t>
144 constexpr T unixday_to_ts_ms(uday_t unix_day) noexcept {
146 }
147
150 template<class T = ts_t>
151 constexpr T uday_to_ts_ms(uday_t unix_day) noexcept {
153 }
154
157 template<class T = ts_t>
161
162//------------------------------------------------------------------------------
163
166 template<class T = ts_t>
170
173 template<class T = ts_t>
177
180 template<class T = ts_t>
181 constexpr T next_day_unixday(uday_t unix_day) noexcept {
183 }
184
185//------------------------------------------------------------------------------
186
189 template<class T = ts_ms_t>
193
196 template<class T = ts_ms_t>
200
203 template<class T = ts_ms_t>
207
208//------------------------------------------------------------------------------
209
212 template<class T = int64_t>
213 constexpr T unix_min(ts_t ts = time_shield::ts()) {
214 return get_unix_min(ts);
215 }
216
219 template<class T = int64_t>
221 return get_unix_min(ts);
222 }
223
226 template<class T = int64_t>
227 constexpr T umin(ts_t ts = time_shield::ts()) {
228 return get_unix_min(ts);
229 }
230
231//------------------------------------------------------------------------------
232
235 template<class T = int>
236 TIME_SHIELD_CONSTEXPR inline T h24_to_h12(T hour) noexcept {
237 return hour24_to_12(hour);
238 }
239
240//------------------------------------------------------------------------------
241
245 template<class T1, class T2 = ts_t>
246 T1 to_dt(T2 ts) {
247 return to_date_time(ts);
248 }
249
253 template<class T1, class T2 = ts_t>
255 return to_date_time(ts);
256 }
257
258//------------------------------------------------------------------------------
259
263 template<class T>
264 inline T to_dt_ms(ts_ms_t ts) {
265 return to_date_time_ms<T>(ts);
266 }
267
271 template<class T>
273 return to_date_time_ms<T>(ts);
274 }
275
276//------------------------------------------------------------------------------
277
278
293 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day) {
294 return to_timestamp(year, month, day);
295 }
296
297
313 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day, int hour) {
314 return to_timestamp(year, month, day, hour);
315 }
316
317
334 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day, int hour, int min) {
335 return to_timestamp(year, month, day, hour, min);
336 }
337
338
356 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day, int hour, int min, int sec) {
357 return to_timestamp(year, month, day, hour, min, sec);
358 }
359
360
375 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day) {
376 return to_timestamp(year, month, day);
377 }
378
379
395 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day, int hour) {
396 return to_timestamp(year, month, day, hour);
397 }
398
399
416 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day, int hour, int min) {
417 return to_timestamp(year, month, day, hour, min);
418 }
419
420
438 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day, int hour, int min, int sec) {
439 return to_timestamp(year, month, day, hour, min, sec);
440 }
441
442
457 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day) {
458 return to_timestamp(year, month, day);
459 }
460
461
477 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day, int hour) {
478 return to_timestamp(year, month, day, hour);
479 }
480
481
498 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day, int hour, int min) {
499 return to_timestamp(year, month, day, hour, min);
500 }
501
502
520 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day, int hour, int min, int sec) {
521 return to_timestamp(year, month, day, hour, min, sec);
522 }
523
524
539 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day) {
540 return to_timestamp(year, month, day);
541 }
542
543
559 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day, int hour) {
560 return to_timestamp(year, month, day, hour);
561 }
562
563
580 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day, int hour, int min) {
581 return to_timestamp(year, month, day, hour, min);
582 }
583
584
602 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day, int hour, int min, int sec) {
603 return to_timestamp(year, month, day, hour, min, sec);
604 }
605
606
621 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day) {
622 return to_timestamp(year, month, day);
623 }
624
625
641 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day, int hour) {
642 return to_timestamp(year, month, day, hour);
643 }
644
645
662 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day, int hour, int min) {
663 return to_timestamp(year, month, day, hour, min);
664 }
665
666
684 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day, int hour, int min, int sec) {
685 return to_timestamp(year, month, day, hour, min, sec);
686 }
687
688//------------------------------------------------------------------------------
689
693 template<class T>
694 TIME_SHIELD_CONSTEXPR inline ts_t to_timestamp(
695 const T& date_time) {
696 return dt_to_timestamp(date_time);
697 }
698
702 template<class T>
703 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(
704 const T& date_time) {
705 return dt_to_timestamp(date_time);
706 }
707
711 template<class T>
712 TIME_SHIELD_CONSTEXPR inline ts_t ts(
713 const T& date_time) {
714 return dt_to_timestamp(date_time);
715 }
716
720 template<class T>
721 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(
722 const T& date_time) {
723 return dt_to_timestamp(date_time);
724 }
725
726//------------------------------------------------------------------------------
727
730 constexpr ts_t ts(const std::tm* timeinfo) {
731 return tm_to_timestamp(timeinfo);
732 }
733
736 constexpr ts_t get_ts(const std::tm* timeinfo) {
737 return tm_to_timestamp(timeinfo);
738 }
739
742 constexpr ts_t timestamp(const std::tm* timeinfo) {
743 return tm_to_timestamp(timeinfo);
744 }
745
748 constexpr ts_t get_timestamp(const std::tm* timeinfo) {
749 return tm_to_timestamp(timeinfo);
750 }
751
754 constexpr ts_t to_ts(const std::tm* timeinfo) {
755 return tm_to_timestamp(timeinfo);
756 }
757
760 constexpr ts_t ts_from_tm(const std::tm* timeinfo) {
761 return tm_to_timestamp(timeinfo);
762 }
763
766 constexpr ts_t to_timestamp(const std::tm* timeinfo) {
767 return tm_to_timestamp(timeinfo);
768 }
769
770//------------------------------------------------------------------------------
771
785 constexpr ts_ms_t ts_ms(year_t year, int month, int day) {
786 return to_timestamp_ms(year, month, day);
787 }
788
803 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour) {
804 return to_timestamp_ms(year, month, day, hour);
805 }
806
822 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour, int min) {
823 return to_timestamp_ms(year, month, day, hour, min);
824 }
825
842 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour, int min, int sec) {
843 return to_timestamp_ms(year, month, day, hour, min, sec);
844 }
845
863 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
864 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
865 }
866
880 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day) {
881 return to_timestamp_ms(year, month, day);
882 }
883
898 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour) {
899 return to_timestamp_ms(year, month, day, hour);
900 }
901
917 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour, int min) {
918 return to_timestamp_ms(year, month, day, hour, min);
919 }
920
937 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour, int min, int sec) {
938 return to_timestamp_ms(year, month, day, hour, min, sec);
939 }
940
958 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
959 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
960 }
961
975 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day) {
976 return to_timestamp_ms(year, month, day);
977 }
978
993 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour) {
994 return to_timestamp_ms(year, month, day, hour);
995 }
996
1012 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour, int min) {
1013 return to_timestamp_ms(year, month, day, hour, min);
1014 }
1015
1032 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour, int min, int sec) {
1033 return to_timestamp_ms(year, month, day, hour, min, sec);
1034 }
1035
1053 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
1054 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
1055 }
1056
1070 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day) {
1071 return to_timestamp_ms(year, month, day);
1072 }
1073
1088 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour) {
1089 return to_timestamp_ms(year, month, day, hour);
1090 }
1091
1107 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour, int min) {
1108 return to_timestamp_ms(year, month, day, hour, min);
1109 }
1110
1127 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour, int min, int sec) {
1128 return to_timestamp_ms(year, month, day, hour, min, sec);
1129 }
1130
1148 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
1149 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
1150 }
1151
1165 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day) {
1166 return to_timestamp_ms(year, month, day);
1167 }
1168
1183 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour) {
1184 return to_timestamp_ms(year, month, day, hour);
1185 }
1186
1202 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour, int min) {
1203 return to_timestamp_ms(year, month, day, hour, min);
1204 }
1205
1222 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour, int min, int sec) {
1223 return to_timestamp_ms(year, month, day, hour, min, sec);
1224 }
1225
1243 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
1244 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
1245 }
1246
1247//------------------------------------------------------------------------------
1248
1252 template<class T>
1253 TIME_SHIELD_CONSTEXPR inline ts_t to_timestamp_ms(
1254 const T& date_time) {
1255 return dt_to_timestamp_ms(date_time);
1256 }
1257
1261 template<class T>
1262 TIME_SHIELD_CONSTEXPR inline ts_t to_ts_ms(
1263 const T& date_time) {
1264 return dt_to_timestamp_ms(date_time);
1265 }
1266
1270 template<class T>
1271 TIME_SHIELD_CONSTEXPR inline ts_t ts_ms(
1272 const T& date_time) {
1273 return dt_to_timestamp_ms(date_time);
1274 }
1275
1279 template<class T>
1280 TIME_SHIELD_CONSTEXPR inline ts_t timestamp_ms(
1281 const T& date_time) {
1282 return dt_to_timestamp_ms(date_time);
1283 }
1284
1285//------------------------------------------------------------------------------
1286
1289 TIME_SHIELD_CONSTEXPR inline ts_t to_timestamp_ms(
1290 const std::tm *timeinfo) {
1291 return tm_to_timestamp_ms(timeinfo);
1292 }
1293
1296 TIME_SHIELD_CONSTEXPR inline ts_t to_ts_ms(
1297 const std::tm *timeinfo) {
1298 return tm_to_timestamp_ms(timeinfo);
1299 }
1300
1303 TIME_SHIELD_CONSTEXPR inline ts_t ts_ms(
1304 const std::tm *timeinfo) {
1305 return tm_to_timestamp_ms(timeinfo);
1306 }
1307
1310 TIME_SHIELD_CONSTEXPR inline ts_t timestamp_ms(
1311 const std::tm *timeinfo) {
1312 return tm_to_timestamp_ms(timeinfo);
1313 }
1314
1315//------------------------------------------------------------------------------
1316
1336 template<class T1 = year_t, class T2 = int, class T3 = int>
1337 constexpr fts_t to_fts(T1 year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1338 return to_ftimestamp(year, month, day, hour, min, sec, ms);
1339 }
1340
1360 template<class T1 = year_t, class T2 = int, class T3 = int>
1361 constexpr fts_t fts(T1 year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1362 return to_ftimestamp(year, month, day, hour, min, sec, ms);
1363 }
1364
1384 template<class T1 = year_t, class T2 = int, class T3 = int>
1385 constexpr fts_t ftimestamp(T1 year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1386 return to_ftimestamp(year, month, day, hour, min, sec, ms);
1387 }
1388
1389//------------------------------------------------------------------------------
1390
1394 template<class T>
1395 constexpr fts_t to_ftimestamp(const T& date_time) {
1396 return dt_to_ftimestamp(date_time);
1397 }
1398
1402 template<class T>
1403 constexpr fts_t to_fts(const T& date_time) {
1404 return dt_to_ftimestamp(date_time);
1405 }
1406
1410 template<class T>
1411 constexpr fts_t fts(const T& date_time) {
1412 return dt_to_ftimestamp(date_time);
1413 }
1414
1418 template<class T>
1419 constexpr fts_t ftimestamp(const T& date_time) {
1420 return dt_to_ftimestamp(date_time);
1421 }
1422
1423//------------------------------------------------------------------------------
1424
1428 constexpr fts_t to_ftimestamp(const std::tm* timeinfo) {
1429 return tm_to_ftimestamp(timeinfo);
1430 }
1431
1435 constexpr fts_t to_fts(const std::tm* timeinfo) {
1436 return tm_to_ftimestamp(timeinfo);
1437 }
1438
1442 constexpr fts_t fts(const std::tm* timeinfo) {
1443 return tm_to_ftimestamp(timeinfo);
1444 }
1445
1449 constexpr fts_t ftimestamp(const std::tm* timeinfo) {
1450 return tm_to_ftimestamp(timeinfo);
1451 }
1452
1453//------------------------------------------------------------------------------
1454
1457 template<class T = int>
1458 constexpr T get_days(ts_t start, ts_t stop) noexcept {
1459 return get_days_difference(start, stop);
1460 }
1461
1464 template<class T = int>
1465 constexpr T days(ts_t start, ts_t stop) noexcept {
1466 return get_days_difference(start, stop);
1467 }
1468
1469//------------------------------------------------------------------------------
1470
1473 template<class T = year_t>
1474 TIME_SHIELD_CONSTEXPR inline T year(ts_t ts = time_shield::ts()) {
1475 return get_year(ts);
1476 }
1477
1480 template<class T = year_t>
1481 TIME_SHIELD_CONSTEXPR inline T to_year(ts_t ts = time_shield::ts()) {
1482 return get_year(ts);
1483 }
1484
1485//------------------------------------------------------------------------------
1486
1489 template<class T = year_t>
1490 TIME_SHIELD_CONSTEXPR inline T year_ms(ts_ms_t ts_ms = time_shield::ts_ms()) {
1491 return get_year_ms(ts_ms);
1492 }
1493
1496 template<class T = year_t>
1497 TIME_SHIELD_CONSTEXPR inline T to_year_ms(ts_ms_t ts_ms = time_shield::ts_ms()) {
1498 return get_year_ms(ts_ms);
1499 }
1500
1501//------------------------------------------------------------------------------
1502
1505 TIME_SHIELD_CONSTEXPR inline ts_t year_start(ts_t ts = time_shield::ts()) {
1506 return start_of_year(ts);
1507 }
1508
1511 TIME_SHIELD_CONSTEXPR inline ts_t year_begin(ts_t ts = time_shield::ts()) {
1512 return start_of_year(ts);
1513 }
1514
1515//------------------------------------------------------------------------------
1516
1519 TIME_SHIELD_CONSTEXPR inline ts_t year_start_ms(ts_t ts_ms = time_shield::ts_ms()) {
1520 return start_of_year_ms(ts_ms);
1521 }
1522
1525 TIME_SHIELD_CONSTEXPR inline ts_t year_begin_ms(ts_t ts_ms = time_shield::ts_ms()) {
1526 return start_of_year_ms(ts_ms);
1527 }
1528
1529//------------------------------------------------------------------------------
1530
1533 template<class T = year_t>
1534 TIME_SHIELD_CONSTEXPR inline ts_t year_start_date(T year) {
1535 return start_of_year_date(year);
1536 }
1537
1540 template<class T = year_t>
1541 TIME_SHIELD_CONSTEXPR inline ts_t year_begin_date(T year) {
1542 return start_of_year_date(year);
1543 }
1544
1545//------------------------------------------------------------------------------
1546
1549 template<class T = year_t>
1550 TIME_SHIELD_CONSTEXPR inline ts_ms_t year_start_date_ms(T year) {
1552 }
1553
1556 template<class T = year_t>
1557 TIME_SHIELD_CONSTEXPR inline ts_ms_t year_begin_date_ms(T year) {
1559 }
1560
1561//------------------------------------------------------------------------------
1562
1565 TIME_SHIELD_CONSTEXPR inline ts_t year_end(ts_t ts = time_shield::ts()) {
1566 return end_of_year(ts);
1567 }
1568
1569//------------------------------------------------------------------------------
1570
1573 TIME_SHIELD_CONSTEXPR inline ts_ms_t year_end_ms(ts_ms_t ts_ms = time_shield::ts_ms()) {
1574 return end_of_year_ms(ts_ms);
1575 }
1576
1577//------------------------------------------------------------------------------
1578
1583 template<class T1 = int, class T2 = year_t, class T3 = int>
1584 constexpr T1 days_in_month(T2 year, T3 month) noexcept {
1585 return num_days_in_month(year, month);
1586 }
1587
1588//------------------------------------------------------------------------------
1589
1592 template<class T1 = int>
1593 constexpr T1 num_days_in_month(ts_t ts = time_shield::ts()) noexcept {
1594 return num_days_in_month_ts(ts);
1595 }
1596
1599 template<class T1 = int>
1600 constexpr T1 days_in_month(ts_t ts = time_shield::ts()) noexcept {
1601 return num_days_in_month_ts(ts);
1602 }
1603
1604//------------------------------------------------------------------------------
1605
1608 template<class T1 = int, class T2 = year_t>
1609 constexpr T1 days_in_year(T2 year) noexcept {
1610 return num_days_in_year(year);
1611 }
1612
1613//------------------------------------------------------------------------------
1614
1617 template<class T = int>
1619 return num_days_in_year_ts(ts);
1620 }
1621
1622//------------------------------------------------------------------------------
1623
1626 constexpr ts_t day_start(ts_t ts = time_shield::ts()) noexcept {
1627 return start_of_day(ts);
1628 }
1629
1630//------------------------------------------------------------------------------
1631
1634 template<class T = int>
1635 constexpr ts_t previous_day_start(ts_t ts = time_shield::ts(), T days = 1) noexcept {
1636 return start_of_prev_day(ts, days);
1637 }
1638
1639//------------------------------------------------------------------------------
1640
1644 return start_of_day(ms_to_sec(ts_ms));
1645 }
1646
1650 return start_of_day(ms_to_sec(ts_ms));
1651 }
1652
1653//------------------------------------------------------------------------------
1654
1658 return start_of_day_ms(ts_ms);
1659 }
1660
1661//------------------------------------------------------------------------------
1662
1665 template<class T = int>
1666 constexpr ts_t next_day_start(ts_t ts, T days = 1) noexcept {
1667 return start_of_next_day(ts, days);
1668 }
1669
1670//------------------------------------------------------------------------------
1671
1674 template<class T = int>
1675 constexpr ts_ms_t next_day_start_ms(ts_ms_t ts_ms, T days = 1) noexcept {
1677 }
1678
1679//------------------------------------------------------------------------------
1680
1683 constexpr ts_t day_end(ts_t ts = time_shield::ts()) noexcept {
1684 return end_of_day(ts);
1685 }
1686
1687//------------------------------------------------------------------------------
1688
1692 return end_of_day_sec(ts_ms);
1693 }
1694
1695//------------------------------------------------------------------------------
1696
1700 return end_of_day_ms(ts_ms);
1701 }
1702
1703//------------------------------------------------------------------------------
1704
1707 template<class T1 = Weekday>
1708 constexpr T1 day_of_week(year_t year, int month, int day) {
1709 return day_of_week_date<T1>(year, month, day);
1710 }
1711
1714 template<class T1 = Weekday>
1715 constexpr T1 day_of_week(year_t year, Month month, int day) {
1716 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1717 }
1718
1721 template<class T1 = Weekday>
1722 constexpr T1 get_weekday(year_t year, int month, int day) {
1723 return day_of_week_date<T1>(year, month, day);
1724 }
1725
1728 template<class T1 = Weekday>
1729 constexpr T1 get_weekday(year_t year, Month month, int day) {
1730 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1731 }
1732
1735 template<class T1 = Weekday>
1736 constexpr T1 weekday(year_t year, int month, int day) {
1737 return day_of_week_date<T1>(year, month, day);
1738 }
1739
1742 template<class T1 = Weekday>
1743 constexpr T1 weekday(year_t year, Month month, int day) {
1744 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1745 }
1746
1749 template<class T1 = Weekday>
1750 constexpr T1 dow(year_t year, int month, int day) {
1751 return day_of_week_date<T1>(year, month, day);
1752 }
1753
1756 template<class T1 = Weekday>
1757 constexpr T1 dow(year_t year, Month month, int day) {
1758 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1759 }
1760
1761//------------------------------------------------------------------------------
1762
1766 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1767 constexpr T1 get_dow(const T2& date) {
1768 return get_weekday_from_date<T1>(date);
1769 }
1770
1774 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1775 constexpr T1 dow_from_date(const T2& date) {
1776 return get_weekday_from_date<T1>(date);
1777 }
1778
1782 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1783 constexpr T1 weekday_of(const T2& date) {
1784 return get_weekday_from_date<T1>(date);
1785 }
1786
1790 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1791 constexpr T1 day_of_week_dt(const T2& date) {
1792 return get_weekday_from_date<T1>(date);
1793 }
1794
1798 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1799 constexpr T1 day_of_week(const T2& date) {
1800 return get_weekday_from_date<T1>(date);
1801 }
1802
1806 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1807 constexpr T1 dow(const T2& date) {
1808 return get_weekday_from_date<T1>(date);
1809 }
1810
1811//------------------------------------------------------------------------------
1812
1813
1816 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1817 constexpr T day_of_week(U ts) noexcept {
1818 return get_weekday_from_ts<T>(ts);
1819 }
1820
1823 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1824 constexpr T dow_ts(U ts) noexcept {
1825 return get_weekday_from_ts<T>(ts);
1826 }
1827
1830 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1831 constexpr T get_dow_from_ts(U ts) noexcept {
1832 return get_weekday_from_ts<T>(ts);
1833 }
1834
1837 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1838 constexpr T weekday_of_ts(U ts) noexcept {
1839 return get_weekday_from_ts<T>(ts);
1840 }
1841
1842//------------------------------------------------------------------------------
1843
1846 template<class T = Weekday>
1849 }
1850
1851//------------------------------------------------------------------------------
1852
1855 TIME_SHIELD_CONSTEXPR inline ts_t month_begin(ts_t ts = time_shield::ts()) {
1856 return start_of_month(ts);
1857 }
1858
1859//------------------------------------------------------------------------------
1860
1863 TIME_SHIELD_CONSTEXPR inline ts_t last_day_of_month(ts_t ts = time_shield::ts()) {
1864 return end_of_month(ts);
1865 }
1866
1867//------------------------------------------------------------------------------
1868
1871 TIME_SHIELD_CONSTEXPR inline ts_t final_sunday_of_month(ts_t ts = time_shield::ts()) {
1872 return last_sunday_of_month(ts);
1873 }
1874
1875//------------------------------------------------------------------------------
1876
1879 template<class T1 = int, class T2 = year_t, class T3 = int>
1880 TIME_SHIELD_CONSTEXPR inline T1 final_sunday_month_day(T2 year, T3 month) {
1881 return last_sunday_month_day(year, month);
1882 }
1883
1884//------------------------------------------------------------------------------
1885
1888 constexpr ts_t hour_begin(ts_t ts = time_shield::ts()) noexcept {
1889 return start_of_hour(ts);
1890 }
1891
1892//------------------------------------------------------------------------------
1893
1897 return start_of_hour_sec(ts_ms);
1898 }
1899
1900//------------------------------------------------------------------------------
1901
1905 return start_of_hour_ms(ts_ms);
1906 }
1907
1908//------------------------------------------------------------------------------
1909
1912 constexpr ts_t finish_of_hour(ts_t ts = time_shield::ts()) noexcept {
1913 return end_of_hour(ts);
1914 }
1915
1916//------------------------------------------------------------------------------
1917
1921 return end_of_hour_sec(ts_ms);
1922 }
1923
1924//------------------------------------------------------------------------------
1925
1929 return end_of_hour_ms(ts_ms);
1930 }
1931
1932//------------------------------------------------------------------------------
1933
1936 template<class T = int>
1937 constexpr T hour_in_day(ts_t ts = time_shield::ts()) noexcept {
1938 return hour_of_day(ts);
1939 }
1940
1941//------------------------------------------------------------------------------
1942
1946 return start_of_week(ts);
1947 }
1948
1949//------------------------------------------------------------------------------
1950
1954 return end_of_week(ts);
1955 }
1956
1957//------------------------------------------------------------------------------
1958
1962 return start_of_saturday(ts);
1963 }
1964
1965//------------------------------------------------------------------------------
1966
1969 constexpr ts_t min_begin(ts_t ts = time_shield::ts()) noexcept {
1970 return start_of_min(ts);
1971 }
1972
1973//------------------------------------------------------------------------------
1974
1977 constexpr ts_t finish_of_min(ts_t ts = time_shield::ts()) noexcept {
1978 return end_of_min(ts);
1979 }
1980
1981//------------------------------------------------------------------------------
1982
1985 TIME_SHIELD_CONSTEXPR inline bool workday(ts_t ts) noexcept {
1986 return is_workday(ts);
1987 }
1988
1991 TIME_SHIELD_CONSTEXPR inline bool workday_ms(ts_ms_t ts_ms) noexcept {
1992 return is_workday_ms(ts_ms);
1993 }
1994
1997 TIME_SHIELD_CONSTEXPR inline bool workday(year_t year, int month, int day) noexcept {
1998 return is_workday(year, month, day);
1999 }
2000
2002
2003}; // namespace time_shield
2004
2005#endif // _TIME_SHIELD_TIME_CONVERSIONS_ALIASES_HPP_INCLUDED
constexpr T start_of_day_from_unix_day_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr ts_t min_begin(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_min function.
TIME_SHIELD_CONSTEXPR ts_t tm_to_timestamp(const std::tm *timeinfo)
Converts a std::tm structure to a timestamp.
constexpr ts_t end_of_hour(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the end of the hour. This function sets the minute and second to 59.
constexpr T unix_day(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr T1 days_in_month(T2 year, T3 month) noexcept
Alias for num_days_in_month function.
TIME_SHIELD_CONSTEXPR fts_t dt_to_ftimestamp(const T &date_time)
Converts a date-time structure to a floating-point timestamp.
TIME_SHIELD_CONSTEXPR fts_t tm_to_ftimestamp(const std::tm *timeinfo)
Converts a std::tm structure to a floating-point timestamp.
constexpr ts_t start_of_saturday(ts_t ts=time_shield::ts())
Get the timestamp of the start of Saturday.
constexpr ts_t end_of_week(ts_t ts=time_shield::ts())
Get the timestamp of the end of the week.
constexpr T get_unixday(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr T next_day_from_unix_day_ms(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
TIME_SHIELD_CONSTEXPR T get_year(ts_t ts=time_shield::ts())
Get the year from the timestamp.
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Get the timestamp in milliseconds of the end of the year.
T to_date_time_ms(ts_ms_t ts)
Converts a timestamp in milliseconds to a date-time structure with milliseconds.
TIME_SHIELD_CONSTEXPR ts_t year_begin_ms(ts_t ts_ms=time_shield::ts_ms())
Alias for start_of_year_ms function.
TIME_SHIELD_CONSTEXPR ts_ms_t year_begin_date_ms(T year)
Alias for start_of_year_date_ms function.
constexpr T get_unix_day(ts_t ts=time_shield::ts()) noexcept
Get UNIX day.
constexpr T next_day_unixday_ms(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
constexpr ts_t start_of_min(ts_t ts=time_shield::ts()) noexcept
Get the timestamp of the beginning of the minute.
constexpr T get_days_difference(ts_t start, ts_t stop) noexcept
Get the number of days between two timestamps.
constexpr ts_ms_t day_start_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_ms function.
TIME_SHIELD_CONSTEXPR T1 last_sunday_month_day(T2 year, T3 month)
Get the day of the last Sunday of the given month and year.
constexpr T unixday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
constexpr T1 get_dow(const T2 &date)
Alias for get_weekday_from_date.
constexpr ts_t finish_of_min(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_min function.
constexpr T1 dow_from_date(const T2 &date)
Alias for get_weekday_from_date.
constexpr ts_ms_t end_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the hour.
constexpr T1 dow(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR bool workday(ts_t ts) noexcept
Alias for is_workday(ts_t).
constexpr T start_of_next_day_from_unix_day(uday_t unix_day) noexcept
Converts a UNIX day to a timestamp representing the start of the next day in seconds.
constexpr ts_ms_t end_of_day_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the day in milliseconds.
constexpr T unixday_to_ts_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr ts_ms_t day_end_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_day_ms function.
constexpr T uday_to_ts_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr ts_ms_t finish_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_hour_ms function.
constexpr T next_day_from_unix_day(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
constexpr ts_t previous_day_start(ts_t ts=time_shield::ts(), T days=1) noexcept
Alias for start_of_prev_day function.
TIME_SHIELD_CONSTEXPR ts_t year_begin_date(T year)
Alias for start_of_year_date function.
TIME_SHIELD_CONSTEXPR ts_t ts(year_t year, int month, int day)
Alias for to_timestamp.
TIME_SHIELD_CONSTEXPR ts_t end_of_year(ts_t ts=time_shield::ts())
Get the end-of-year timestamp.
TIME_SHIELD_CONSTEXPR ts_ms_t year_start_date_ms(T year)
Alias for start_of_year_date_ms function.
TIME_SHIELD_CONSTEXPR T to_year(ts_t ts=time_shield::ts())
Alias for get_year function.
constexpr T get_unix_day_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Get UNIX day from milliseconds timestamp.
constexpr ts_t finish_of_week(ts_t ts=time_shield::ts())
Alias for end_of_week function.
constexpr T unix_day_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
constexpr ts_ms_t start_of_day_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the start of the day timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR T hour24_to_12(T hour) noexcept
Converts a 24-hour format hour to a 12-hour format.
constexpr ts_t start_of_hour(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the start of the hour.
constexpr T to_unix_year(ts_t ts) noexcept
Alias for get_unix_year function.
constexpr T hour_of_day(ts_t ts=time_shield::ts()) noexcept
Get the hour of the day.
TIME_SHIELD_CONSTEXPR ts_t year_begin(ts_t ts=time_shield::ts())
Alias for start_of_year function.
constexpr T uday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
constexpr T unix_year(ts_t ts) noexcept
Alias for get_unix_year function.
constexpr T get_unix_min(ts_t ts=time_shield::ts())
Get UNIX minute.
constexpr T1 weekday_of(const T2 &date)
Alias for get_weekday_from_date.
constexpr T unix_day_to_timestamp(uday_t unix_day) noexcept
Converts a UNIX day to a timestamp in seconds.
constexpr ts_ms_t hour_begin_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_hour_ms function.
TIME_SHIELD_CONSTEXPR ts_t to_ts(year_t year, int month, int day)
Alias for to_timestamp.
constexpr ts_t saturday_begin(ts_t ts=time_shield::ts())
Alias for start_of_saturday function.
T to_dt_struct_ms(ts_ms_t ts)
Alias for to_date_time_ms function.
TIME_SHIELD_CONSTEXPR ts_t start_of_year(ts_t ts) noexcept
Get the start of the year timestamp.
TIME_SHIELD_CONSTEXPR T get_year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Get the year from the timestamp in milliseconds.
constexpr ts_t end_of_day(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the end of the day.
constexpr T1 get_weekday(year_t year, int month, int day)
Alias for day_of_week_date.
constexpr T weekday_of_ts(U ts) noexcept
Alias for get_weekday_from_ts.
TIME_SHIELD_CONSTEXPR ts_t tm_to_timestamp_ms(const std::tm *timeinfo)
Converts a std::tm structure to a timestamp in milliseconds.
constexpr T dow_ts(U ts) noexcept
Alias for get_weekday_from_ts.
constexpr ts_t day_start(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_day function.
constexpr ts_t finish_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_hour_sec function.
constexpr T next_day_unix_day(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
constexpr ts_t ts_from_tm(const std::tm *timeinfo)
Alias for tm_to_timestamp.
constexpr fts_t to_fts(T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
Alias for to_ftimestamp.
TIME_SHIELD_CONSTEXPR ts_t final_sunday_of_month(ts_t ts=time_shield::ts())
Alias for last_sunday_of_month function.
constexpr T1 day_of_week(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR ts_t start_of_month(ts_t ts=time_shield::ts())
Get the timestamp at the start of the current month.
constexpr T get_weekday_from_ts_ms(ts_ms_t ts_ms)
Get the weekday from a timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR ts_t dt_to_timestamp(const T &date_time)
Converts a date-time structure to a timestamp.
constexpr ts_ms_t start_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the start of the hour. This function sets the minute and second to zero.
T1 to_dt_struct(T2 ts)
Alias for to_date_time function.
TIME_SHIELD_CONSTEXPR ts_t year_start_date(T year)
Alias for start_of_year_date function.
TIME_SHIELD_CONSTEXPR ts_t get_ts(year_t year, int month, int day)
Alias for to_timestamp.
TIME_SHIELD_CONSTEXPR ts_t last_day_of_month(ts_t ts=time_shield::ts())
Alias for end_of_month function.
TIME_SHIELD_CONSTEXPR T1 num_days_in_month_ts(ts_t ts=time_shield::ts()) noexcept
Get the number of days in the month of the given timestamp.
constexpr T1 num_days_in_month(ts_t ts=time_shield::ts()) noexcept
Alias for num_days_in_month_ts function.
constexpr ts_t start_day_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_sec function.
TIME_SHIELD_CONSTEXPR ts_t year_start(ts_t ts=time_shield::ts())
Alias for start_of_year function.
constexpr T1 ms_to_sec(T2 ts_ms) noexcept
Converts a timestamp from milliseconds to seconds.
constexpr fts_t to_ftimestamp(const T &date_time)
Alias for dt_to_ftimestamp.
constexpr T start_of_day_from_unix_day(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
TIME_SHIELD_CONSTEXPR ts_t end_of_month(ts_t ts=time_shield::ts())
Get the last timestamp of the current month.
TIME_SHIELD_CONSTEXPR ts_t get_timestamp(year_t year, int month, int day)
Alias for to_timestamp.
T to_dt_ms(ts_ms_t ts)
Alias for to_date_time_ms function.
TIME_SHIELD_CONSTEXPR ts_ms_t year_end_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for end_of_year_ms function.
constexpr ts_t day_end(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_day function.
constexpr ts_t start_of_day(ts_t ts=time_shield::ts()) noexcept
Get the start of the day timestamp.
TIME_SHIELD_CONSTEXPR ts_t year_start_ms(ts_t ts_ms=time_shield::ts_ms())
Alias for start_of_year_ms function.
constexpr ts_t end_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the hour.
constexpr ts_ms_t next_day_start_ms(ts_ms_t ts_ms, T days=1) noexcept
Alias for start_of_next_day_ms function.
constexpr T uday_to_ts(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
TIME_SHIELD_CONSTEXPR ts_t to_timestamp(const T &date_time)
Alias for dt_to_timestamp function.
constexpr ts_ms_t ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr T next_day_unix_day_ms(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
constexpr T num_days_in_year_ts(ts_t ts=time_shield::ts())
Get the number of days in the current year.
constexpr ts_t week_begin(ts_t ts=time_shield::ts())
Alias for start_of_week function.
constexpr ts_t end_of_min(ts_t ts=time_shield::ts()) noexcept
Get the timestamp of the end of the minute.
constexpr T hour_in_day(ts_t ts=time_shield::ts()) noexcept
Alias for hour_of_day function.
constexpr T umin(ts_t ts=time_shield::ts())
Alias for get_unix_min function.
constexpr ts_ms_t start_of_next_day_ms(ts_ms_t ts_ms, T days=1) noexcept
Get the timestamp of the start of the day after a specified number of days.
constexpr T day_of_week_ms(ts_ms_t ts_ms)
Alias for get_weekday_from_ts_ms function.
TIME_SHIELD_CONSTEXPR ts_t last_sunday_of_month(ts_t ts=time_shield::ts())
Get the timestamp of the last Sunday of the current month.
TIME_SHIELD_CONSTEXPR ts_t start_of_year_date(T year)
Get the timestamp of the start of the year.
constexpr T get_unix_year(ts_t ts) noexcept
Converts a UNIX timestamp to a year.
constexpr ts_t start_of_next_day(ts_t ts, T days=1) noexcept
Get the timestamp of the start of the day after a specified number of days.
TIME_SHIELD_CONSTEXPR T1 final_sunday_month_day(T2 year, T3 month)
Alias for last_sunday_month_day function.
constexpr T to_unix_min(ts_t ts=time_shield::ts())
Alias for get_unix_min function.
constexpr ts_ms_t get_ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr T unix_min(ts_t ts=time_shield::ts())
Alias for get_unix_min function.
constexpr T unix_day_to_timestamp_ms(uday_t unix_day) noexcept
Converts a UNIX day to a timestamp in milliseconds.
constexpr ts_t day_start_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_sec function.
T1 to_date_time(T2 ts)
Converts a timestamp to a date-time structure.
TIME_SHIELD_CONSTEXPR ts_t dt_to_timestamp_ms(const T &date_time)
Converts a date-time structure to a timestamp in milliseconds.
constexpr T unixday(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr T days(ts_t start, ts_t stop) noexcept
Alias for get_days_difference function.
constexpr T1 day_of_week_date(T2 year, T3 month, T4 day)
Get the day of the week.
constexpr ts_t start_of_week(ts_t ts=time_shield::ts())
Get the timestamp of the beginning of the week.
TIME_SHIELD_CONSTEXPR bool workday_ms(ts_ms_t ts_ms) noexcept
Alias for is_workday(ts_ms_t).
constexpr ts_t next_day_start(ts_t ts, T days=1) noexcept
Alias for start_of_next_day function.
constexpr T1 weekday(year_t year, int month, int day)
Alias for day_of_week_date.
constexpr T get_days(ts_t start, ts_t stop) noexcept
Alias for get_days_difference function.
constexpr T start_of_next_day_from_unix_day_ms(uday_t unix_day) noexcept
Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.
TIME_SHIELD_CONSTEXPR ts_t year_end(ts_t ts=time_shield::ts())
Alias for end_of_year function.
constexpr T get_dow_from_ts(U ts) noexcept
Alias for get_weekday_from_ts.
constexpr T1 get_weekday_from_date(const T2 &date)
Get the day of the week from a date structure.
constexpr ts_t hour_begin_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_hour_sec function.
TIME_SHIELD_CONSTEXPR T year(ts_t ts=time_shield::ts())
Alias for get_year function.
constexpr ts_t start_of_prev_day(ts_t ts=time_shield::ts(), T days=1) noexcept
Get timestamp of the start of the previous day.
constexpr T1 days_in_year(T2 year) noexcept
Alias for num_days_in_year function.
constexpr ts_ms_t to_ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr ts_t day_end_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_day_sec function.
T1 to_dt(T2 ts)
Alias for to_date_time function.
TIME_SHIELD_CONSTEXPR ts_t month_begin(ts_t ts=time_shield::ts())
Alias for start_of_month function.
TIME_SHIELD_CONSTEXPR T h24_to_h12(T hour) noexcept
Alias for hour24_to_12 function.
constexpr T unix_day_to_ts(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr T unix_day_to_ts_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr ts_t finish_of_hour(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_hour function.
constexpr ts_t hour_begin(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_hour function.
constexpr T get_weekday_from_ts(ts_t ts) noexcept
Get the weekday from a timestamp.
TIME_SHIELD_CONSTEXPR T to_year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for get_year_ms function.
TIME_SHIELD_CONSTEXPR T year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for get_year_ms function.
constexpr T1 day_of_week_dt(const T2 &date)
Alias for get_weekday_from_date.
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_year_date_ms(T year)
Get the timestamp in milliseconds of the start of the year.
constexpr T unixday_to_ts(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
constexpr T next_day_unixday(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
constexpr T get_unixday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
constexpr ts_t start_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the start of the hour.
constexpr T uday(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr ts_t end_of_day_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the day in seconds.
TIME_SHIELD_CONSTEXPR ts_t to_timestamp_ms(const T &date_time)
Alias for dt_to_timestamp_ms function.
constexpr T days_in_year_ts(ts_t ts=time_shield::ts())
Alias for num_days_in_year_ts function.
constexpr T1 num_days_in_year(T2 year) noexcept
Get the number of days in a given year.
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_year_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the start of the year timestamp in milliseconds.
bool is_workday(const std::string &str)
Parse an ISO8601 string and check if it falls on a workday using second precision.
bool is_workday_ms(const std::string &str)
Parse an ISO8601 string and check if it falls on a workday using millisecond precision.
int64_t ts_t
Unix timestamp in seconds since 1970‑01‑01T00:00:00Z.
Definition types.hpp:46
int64_t ts_ms_t
Unix timestamp in milliseconds since epoch.
Definition types.hpp:47
int64_t uday_t
Unix day count since 1970‑01‑01 (days since epoch).
Definition types.hpp:42
double fts_t
Floating-point timestamp (fractional seconds since epoch).
Definition types.hpp:49
int64_t year_t
Year as an integer (e.g., 2024).
Definition types.hpp:41
ts_t ts() noexcept
Get the current UTC timestamp in seconds.
ts_t timestamp() noexcept
Get the current UTC timestamp in seconds.
fts_t ftimestamp() noexcept
Get the current UTC timestamp in floating-point seconds.
ts_ms_t ts_ms() noexcept
Get the current UTC timestamp in milliseconds.
ts_ms_t timestamp_ms() noexcept
Get the current UTC timestamp in milliseconds.
fts_t fts() noexcept
Get the current UTC timestamp in floating-point seconds.
Main namespace for the Time Shield library.