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#pragma once
2#ifndef _TIME_SHIELD_TIME_CONVERSIONS_ALIASES_HPP_INCLUDED
3#define _TIME_SHIELD_TIME_CONVERSIONS_ALIASES_HPP_INCLUDED
4
11
12namespace time_shield {
13
16
19 template<class T = year_t>
20 constexpr const T unix_year(ts_t ts) noexcept {
21 return get_unix_year<T>(ts);
22 }
23
26 template<class T = year_t>
27 constexpr const T to_unix_year(ts_t ts) noexcept {
28 return get_unix_year<T>(ts);
29 }
30
31//------------------------------------------------------------------------------
32
33
36 template<class T = uday_t>
37 constexpr T get_unixday(ts_t ts = time_shield::ts()) noexcept {
38 return get_unix_day<T>(ts);
39 }
40
41
44 template<class T = uday_t>
45 constexpr T unix_day(ts_t ts = time_shield::ts()) noexcept {
46 return get_unix_day<T>(ts);
47 }
48
49
52 template<class T = uday_t>
53 constexpr T unixday(ts_t ts = time_shield::ts()) noexcept {
54 return get_unix_day<T>(ts);
55 }
56
57
60 template<class T = uday_t>
61 constexpr T uday(ts_t ts = time_shield::ts()) noexcept {
62 return get_unix_day<T>(ts);
63 }
64
65//------------------------------------------------------------------------------
66
67
70 template<class T = uday_t>
71 constexpr T get_unixday_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
72 return get_unix_day_ms<T>(t_ms);
73 }
74
75
78 template<class T = uday_t>
79 constexpr T unix_day_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
80 return get_unix_day_ms<T>(t_ms);
81 }
82
83
86 template<class T = uday_t>
87 constexpr T unixday_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
88 return get_unix_day_ms<T>(t_ms);
89 }
90
91
94 template<class T = uday_t>
95 constexpr T uday_ms(ts_ms_t t_ms = time_shield::ts_ms()) noexcept {
96 return get_unix_day_ms<T>(t_ms);
97 }
98
99//------------------------------------------------------------------------------
100
103 template<class T = ts_t>
104 constexpr const T unix_day_to_ts(uday_t unix_day) noexcept {
106 }
107
110 template<class T = ts_t>
111 constexpr const T unixday_to_ts(uday_t unix_day) noexcept {
113 }
114
117 template<class T = ts_t>
118 constexpr const T uday_to_ts(uday_t unix_day) noexcept {
120 }
121
124 template<class T = ts_t>
125 constexpr const T start_of_day_from_unix_day(uday_t unix_day) noexcept {
127 }
128
129//------------------------------------------------------------------------------
130
133 template<class T = ts_t>
134 constexpr const T unix_day_to_ts_ms(uday_t unix_day) noexcept {
136 }
137
140 template<class T = ts_t>
141 constexpr const T unixday_to_ts_ms(uday_t unix_day) noexcept {
143 }
144
147 template<class T = ts_t>
148 constexpr const T uday_to_ts_ms(uday_t unix_day) noexcept {
150 }
151
154 template<class T = ts_t>
155 constexpr const T start_of_day_from_unix_day_ms(uday_t unix_day) noexcept {
157 }
158
159//------------------------------------------------------------------------------
160
163 template<class T = ts_t>
164 constexpr const T next_day_from_unix_day(uday_t unix_day) noexcept {
166 }
167
170 template<class T = ts_t>
171 constexpr const T next_day_unix_day(uday_t unix_day) noexcept {
173 }
174
177 template<class T = ts_t>
178 constexpr const T next_day_unixday(uday_t unix_day) noexcept {
180 }
181
182//------------------------------------------------------------------------------
183
186 template<class T = ts_ms_t>
190
193 template<class T = ts_ms_t>
194 constexpr const T next_day_unix_day_ms(uday_t unix_day) noexcept {
196 }
197
200 template<class T = ts_ms_t>
201 constexpr const T next_day_unixday_ms(uday_t unix_day) noexcept {
203 }
204
205//------------------------------------------------------------------------------
206
209 template<class T = int64_t>
210 constexpr const T unix_min(ts_t ts = ts()) {
211 return get_unix_min(ts);
212 }
213
216 template<class T = int64_t>
217 constexpr const T to_unix_min(ts_t ts = ts()) {
218 return get_unix_min(ts);
219 }
220
223 template<class T = int64_t>
224 constexpr const T umin(ts_t ts = ts()) {
225 return get_unix_min(ts);
226 }
227
228//------------------------------------------------------------------------------
229
232 template<class T = int>
233 TIME_SHIELD_CONSTEXPR inline const T h24_to_h12(T hour) noexcept {
234 return hour24_to_12(hour);
235 }
236
237//------------------------------------------------------------------------------
238
242 template<class T1, class T2 = ts_t>
243 T1 to_dt(T2 ts) {
244 return to_date_time(ts);
245 }
246
250 template<class T1, class T2 = ts_t>
252 return to_date_time(ts);
253 }
254
255//------------------------------------------------------------------------------
256
260 template<class T>
261 inline T to_dt_ms(ts_ms_t ts) {
262 return to_date_time_ms<T>(ts);
263 }
264
268 template<class T>
270 return to_date_time_ms<T>(ts);
271 }
272
273//------------------------------------------------------------------------------
274
275
290 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day) {
291 return to_timestamp(year, month, day);
292 }
293
294
310 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day, int hour) {
311 return to_timestamp(year, month, day, hour);
312 }
313
314
331 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day, int hour, int min) {
332 return to_timestamp(year, month, day, hour, min);
333 }
334
335
353 TIME_SHIELD_CONSTEXPR inline ts_t ts(year_t year, int month, int day, int hour, int min, int sec) {
354 return to_timestamp(year, month, day, hour, min, sec);
355 }
356
357
372 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day) {
373 return to_timestamp(year, month, day);
374 }
375
376
392 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day, int hour) {
393 return to_timestamp(year, month, day, hour);
394 }
395
396
413 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day, int hour, int min) {
414 return to_timestamp(year, month, day, hour, min);
415 }
416
417
435 TIME_SHIELD_CONSTEXPR inline ts_t get_ts(year_t year, int month, int day, int hour, int min, int sec) {
436 return to_timestamp(year, month, day, hour, min, sec);
437 }
438
439
454 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day) {
455 return to_timestamp(year, month, day);
456 }
457
458
474 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day, int hour) {
475 return to_timestamp(year, month, day, hour);
476 }
477
478
495 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day, int hour, int min) {
496 return to_timestamp(year, month, day, hour, min);
497 }
498
499
517 TIME_SHIELD_CONSTEXPR inline ts_t get_timestamp(year_t year, int month, int day, int hour, int min, int sec) {
518 return to_timestamp(year, month, day, hour, min, sec);
519 }
520
521
536 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day) {
537 return to_timestamp(year, month, day);
538 }
539
540
556 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day, int hour) {
557 return to_timestamp(year, month, day, hour);
558 }
559
560
577 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day, int hour, int min) {
578 return to_timestamp(year, month, day, hour, min);
579 }
580
581
599 TIME_SHIELD_CONSTEXPR inline ts_t timestamp(year_t year, int month, int day, int hour, int min, int sec) {
600 return to_timestamp(year, month, day, hour, min, sec);
601 }
602
603
618 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day) {
619 return to_timestamp(year, month, day);
620 }
621
622
638 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day, int hour) {
639 return to_timestamp(year, month, day, hour);
640 }
641
642
659 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day, int hour, int min) {
660 return to_timestamp(year, month, day, hour, min);
661 }
662
663
681 TIME_SHIELD_CONSTEXPR inline ts_t to_ts(year_t year, int month, int day, int hour, int min, int sec) {
682 return to_timestamp(year, month, day, hour, min, sec);
683 }
684
685//------------------------------------------------------------------------------
686
690 template<class T>
691 TIME_SHIELD_CONSTEXPR inline const ts_t to_timestamp(
692 const T& date_time) {
693 return dt_to_timestamp(date_time);
694 }
695
699 template<class T>
700 TIME_SHIELD_CONSTEXPR inline const ts_t to_ts(
701 const T& date_time) {
702 return dt_to_timestamp(date_time);
703 }
704
708 template<class T>
709 TIME_SHIELD_CONSTEXPR inline const ts_t ts(
710 const T& date_time) {
711 return dt_to_timestamp(date_time);
712 }
713
717 template<class T>
718 TIME_SHIELD_CONSTEXPR inline const ts_t timestamp(
719 const T& date_time) {
720 return dt_to_timestamp(date_time);
721 }
722
723//------------------------------------------------------------------------------
724
727 constexpr ts_t ts(const std::tm* timeinfo) {
728 return tm_to_timestamp(timeinfo);
729 }
730
733 constexpr ts_t get_ts(const std::tm* timeinfo) {
734 return tm_to_timestamp(timeinfo);
735 }
736
739 constexpr ts_t timestamp(const std::tm* timeinfo) {
740 return tm_to_timestamp(timeinfo);
741 }
742
745 constexpr ts_t get_timestamp(const std::tm* timeinfo) {
746 return tm_to_timestamp(timeinfo);
747 }
748
751 constexpr ts_t to_ts(const std::tm* timeinfo) {
752 return tm_to_timestamp(timeinfo);
753 }
754
757 constexpr ts_t ts_from_tm(const std::tm* timeinfo) {
758 return tm_to_timestamp(timeinfo);
759 }
760
763 constexpr ts_t to_timestamp(const std::tm* timeinfo) {
764 return tm_to_timestamp(timeinfo);
765 }
766
767//------------------------------------------------------------------------------
768
782 constexpr ts_ms_t ts_ms(year_t year, int month, int day) {
783 return to_timestamp_ms(year, month, day);
784 }
785
800 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour) {
801 return to_timestamp_ms(year, month, day, hour);
802 }
803
819 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour, int min) {
820 return to_timestamp_ms(year, month, day, hour, min);
821 }
822
839 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour, int min, int sec) {
840 return to_timestamp_ms(year, month, day, hour, min, sec);
841 }
842
860 constexpr ts_ms_t ts_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
861 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
862 }
863
877 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day) {
878 return to_timestamp_ms(year, month, day);
879 }
880
895 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour) {
896 return to_timestamp_ms(year, month, day, hour);
897 }
898
914 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour, int min) {
915 return to_timestamp_ms(year, month, day, hour, min);
916 }
917
934 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour, int min, int sec) {
935 return to_timestamp_ms(year, month, day, hour, min, sec);
936 }
937
955 constexpr ts_ms_t get_ts_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
956 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
957 }
958
972 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day) {
973 return to_timestamp_ms(year, month, day);
974 }
975
990 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour) {
991 return to_timestamp_ms(year, month, day, hour);
992 }
993
1009 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour, int min) {
1010 return to_timestamp_ms(year, month, day, hour, min);
1011 }
1012
1029 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour, int min, int sec) {
1030 return to_timestamp_ms(year, month, day, hour, min, sec);
1031 }
1032
1050 constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
1051 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
1052 }
1053
1067 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day) {
1068 return to_timestamp_ms(year, month, day);
1069 }
1070
1085 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour) {
1086 return to_timestamp_ms(year, month, day, hour);
1087 }
1088
1104 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour, int min) {
1105 return to_timestamp_ms(year, month, day, hour, min);
1106 }
1107
1124 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour, int min, int sec) {
1125 return to_timestamp_ms(year, month, day, hour, min, sec);
1126 }
1127
1145 constexpr ts_ms_t timestamp_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
1146 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
1147 }
1148
1162 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day) {
1163 return to_timestamp_ms(year, month, day);
1164 }
1165
1180 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour) {
1181 return to_timestamp_ms(year, month, day, hour);
1182 }
1183
1199 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour, int min) {
1200 return to_timestamp_ms(year, month, day, hour, min);
1201 }
1202
1219 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour, int min, int sec) {
1220 return to_timestamp_ms(year, month, day, hour, min, sec);
1221 }
1222
1240 constexpr ts_ms_t to_ts_ms(year_t year, int month, int day, int hour, int min, int sec, int ms) {
1241 return to_timestamp_ms(year, month, day, hour, min, sec, ms);
1242 }
1243
1244//------------------------------------------------------------------------------
1245
1249 template<class T>
1250 TIME_SHIELD_CONSTEXPR inline const ts_t to_timestamp_ms(
1251 const T& date_time) {
1252 return dt_to_timestamp_ms(date_time);
1253 }
1254
1258 template<class T>
1259 TIME_SHIELD_CONSTEXPR inline const ts_t to_ts_ms(
1260 const T& date_time) {
1261 return dt_to_timestamp_ms(date_time);
1262 }
1263
1267 template<class T>
1268 TIME_SHIELD_CONSTEXPR inline const ts_t ts_ms(
1269 const T& date_time) {
1270 return dt_to_timestamp_ms(date_time);
1271 }
1272
1276 template<class T>
1277 TIME_SHIELD_CONSTEXPR inline const ts_t timestamp_ms(
1278 const T& date_time) {
1279 return dt_to_timestamp_ms(date_time);
1280 }
1281
1282//------------------------------------------------------------------------------
1283
1286 TIME_SHIELD_CONSTEXPR inline const ts_t to_timestamp_ms(
1287 const std::tm *timeinfo) {
1288 return tm_to_timestamp_ms(timeinfo);
1289 }
1290
1293 TIME_SHIELD_CONSTEXPR inline const ts_t to_ts_ms(
1294 const std::tm *timeinfo) {
1295 return tm_to_timestamp_ms(timeinfo);
1296 }
1297
1300 TIME_SHIELD_CONSTEXPR inline const ts_t ts_ms(
1301 const std::tm *timeinfo) {
1302 return tm_to_timestamp_ms(timeinfo);
1303 }
1304
1307 TIME_SHIELD_CONSTEXPR inline const ts_t timestamp_ms(
1308 const std::tm *timeinfo) {
1309 return tm_to_timestamp_ms(timeinfo);
1310 }
1311
1312//------------------------------------------------------------------------------
1313
1333 template<class T1 = year_t, class T2 = int, class T3 = int>
1334 constexpr fts_t to_fts(T1 year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1335 return to_ftimestamp(year, month, day, hour, min, sec, ms);
1336 }
1337
1357 template<class T1 = year_t, class T2 = int, class T3 = int>
1358 constexpr fts_t fts(T1 year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1359 return to_ftimestamp(year, month, day, hour, min, sec, ms);
1360 }
1361
1381 template<class T1 = year_t, class T2 = int, class T3 = int>
1382 constexpr fts_t ftimestamp(T1 year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1383 return to_ftimestamp(year, month, day, hour, min, sec, ms);
1384 }
1385
1386//------------------------------------------------------------------------------
1387
1391 template<class T>
1392 constexpr fts_t to_ftimestamp(const T& date_time) {
1393 return dt_to_ftimestamp(date_time);
1394 }
1395
1399 template<class T>
1400 constexpr fts_t to_fts(const T& date_time) {
1401 return dt_to_ftimestamp(date_time);
1402 }
1403
1407 template<class T>
1408 constexpr fts_t fts(const T& date_time) {
1409 return dt_to_ftimestamp(date_time);
1410 }
1411
1415 template<class T>
1416 constexpr fts_t ftimestamp(const T& date_time) {
1417 return dt_to_ftimestamp(date_time);
1418 }
1419
1420//------------------------------------------------------------------------------
1421
1425 constexpr fts_t to_ftimestamp(const std::tm* timeinfo) {
1426 return tm_to_ftimestamp(timeinfo);
1427 }
1428
1432 constexpr fts_t to_fts(const std::tm* timeinfo) {
1433 return tm_to_ftimestamp(timeinfo);
1434 }
1435
1439 constexpr fts_t fts(const std::tm* timeinfo) {
1440 return tm_to_ftimestamp(timeinfo);
1441 }
1442
1446 constexpr fts_t ftimestamp(const std::tm* timeinfo) {
1447 return tm_to_ftimestamp(timeinfo);
1448 }
1449
1450//------------------------------------------------------------------------------
1451
1454 template<class T = int>
1455 constexpr const T get_days(ts_t start, ts_t stop) noexcept {
1456 return get_days_difference(start, stop);
1457 }
1458
1461 template<class T = int>
1462 constexpr const T days(ts_t start, ts_t stop) noexcept {
1463 return get_days_difference(start, stop);
1464 }
1465
1466//------------------------------------------------------------------------------
1467
1470 template<class T = year_t>
1471 TIME_SHIELD_CONSTEXPR inline const T year(ts_t ts = ts()) {
1472 return get_year(ts);
1473 }
1474
1477 template<class T = year_t>
1478 TIME_SHIELD_CONSTEXPR inline const T to_year(ts_t ts = ts()) {
1479 return get_year(ts);
1480 }
1481
1482//------------------------------------------------------------------------------
1483
1486 template<class T = year_t>
1487 TIME_SHIELD_CONSTEXPR inline const T year_ms(ts_ms_t ts_ms = ts_ms()) {
1488 return get_year_ms(ts_ms);
1489 }
1490
1493 template<class T = year_t>
1494 TIME_SHIELD_CONSTEXPR inline const T to_year_ms(ts_ms_t ts_ms = ts_ms()) {
1495 return get_year_ms(ts_ms);
1496 }
1497
1498//------------------------------------------------------------------------------
1499
1502 TIME_SHIELD_CONSTEXPR inline const ts_t year_start(ts_t ts = time_shield::ts()) {
1503 return start_of_year(ts);
1504 }
1505
1508 TIME_SHIELD_CONSTEXPR inline const ts_t year_begin(ts_t ts = time_shield::ts()) {
1509 return start_of_year(ts);
1510 }
1511
1512//------------------------------------------------------------------------------
1513
1516 TIME_SHIELD_CONSTEXPR inline const ts_t year_start_ms(ts_t ts_ms = time_shield::ts_ms()) {
1517 return start_of_year_ms(ts_ms);
1518 }
1519
1522 TIME_SHIELD_CONSTEXPR inline const ts_t year_begin_ms(ts_t ts_ms = time_shield::ts_ms()) {
1523 return start_of_year_ms(ts_ms);
1524 }
1525
1526//------------------------------------------------------------------------------
1527
1530 template<class T = year_t>
1531 TIME_SHIELD_CONSTEXPR inline const ts_t year_start_date(T year) {
1532 return start_of_year_date(year);
1533 }
1534
1537 template<class T = year_t>
1538 TIME_SHIELD_CONSTEXPR inline const ts_t year_begin_date(T year) {
1539 return start_of_year_date(year);
1540 }
1541
1542//------------------------------------------------------------------------------
1543
1546 template<class T = year_t>
1547 TIME_SHIELD_CONSTEXPR inline const ts_ms_t year_start_date_ms(T year) {
1549 }
1550
1553 template<class T = year_t>
1554 TIME_SHIELD_CONSTEXPR inline const ts_ms_t year_begin_date_ms(T year) {
1556 }
1557
1558//------------------------------------------------------------------------------
1559
1562 TIME_SHIELD_CONSTEXPR inline const ts_t year_end(ts_t ts = time_shield::ts()) {
1563 return end_of_year(ts);
1564 }
1565
1566//------------------------------------------------------------------------------
1567
1570 TIME_SHIELD_CONSTEXPR inline const ts_ms_t year_end_ms(ts_ms_t ts_ms = time_shield::ts_ms()) {
1571 return end_of_year_ms(ts_ms);
1572 }
1573
1574//------------------------------------------------------------------------------
1575
1580 template<class T1 = int, class T2 = year_t, class T3 = int>
1581 constexpr const T1 days_in_month(T2 year, T3 month) noexcept {
1582 return num_days_in_month(year, month);
1583 }
1584
1585//------------------------------------------------------------------------------
1586
1589 template<class T1 = int>
1590 constexpr const T1 num_days_in_month(ts_t ts = time_shield::ts()) noexcept {
1591 return num_days_in_month_ts(ts);
1592 }
1593
1596 template<class T1 = int>
1597 constexpr const T1 days_in_month(ts_t ts = time_shield::ts()) noexcept {
1598 return num_days_in_month_ts(ts);
1599 }
1600
1601//------------------------------------------------------------------------------
1602
1605 template<class T1 = int, class T2 = year_t>
1606 constexpr const T1 days_in_year(T2 year) noexcept {
1607 return num_days_in_year(year);
1608 }
1609
1610//------------------------------------------------------------------------------
1611
1614 template<class T = int>
1615 constexpr const T days_in_year_ts(ts_t ts = time_shield::ts()) {
1616 return num_days_in_year_ts(ts);
1617 }
1618
1619//------------------------------------------------------------------------------
1620
1623 constexpr const ts_t day_start(ts_t ts = time_shield::ts()) noexcept {
1624 return start_of_day(ts);
1625 }
1626
1627//------------------------------------------------------------------------------
1628
1631 template<class T = int>
1632 constexpr const ts_t previous_day_start(ts_t ts = time_shield::ts(), T days = 1) noexcept {
1633 return start_of_prev_day(ts, days);
1634 }
1635
1636//------------------------------------------------------------------------------
1637
1640 constexpr const ts_t day_start_sec(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1641 return start_of_day(ms_to_sec(ts_ms));
1642 }
1643
1646 constexpr const ts_t start_day_sec(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1647 return start_of_day(ms_to_sec(ts_ms));
1648 }
1649
1650//------------------------------------------------------------------------------
1651
1654 constexpr const ts_ms_t day_start_ms(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1655 return start_of_day_ms(ts_ms);
1656 }
1657
1658//------------------------------------------------------------------------------
1659
1662 template<class T = int>
1663 constexpr const ts_t next_day_start(ts_t ts, T days = 1) noexcept {
1664 return start_of_next_day(ts, days);
1665 }
1666
1667//------------------------------------------------------------------------------
1668
1671 template<class T = int>
1672 constexpr const ts_ms_t next_day_start_ms(ts_ms_t ts_ms, T days = 1) noexcept {
1674 }
1675
1676//------------------------------------------------------------------------------
1677
1680 constexpr const ts_t day_end(const ts_t& ts = time_shield::ts()) noexcept {
1681 return end_of_day(ts);
1682 }
1683
1684//------------------------------------------------------------------------------
1685
1688 constexpr const ts_t day_end_sec(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1689 return end_of_day_sec(ts_ms);
1690 }
1691
1692//------------------------------------------------------------------------------
1693
1696 constexpr const ts_ms_t day_end_ms(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1697 return end_of_day_ms(ts_ms);
1698 }
1699
1700//------------------------------------------------------------------------------
1701
1704 template<class T1 = Weekday>
1705 constexpr const T1 day_of_week(year_t year, int month, int day) {
1706 return day_of_week_date<T1>(year, month, day);
1707 }
1708
1711 template<class T1 = Weekday>
1712 constexpr const T1 day_of_week(year_t year, Month month, int day) {
1713 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1714 }
1715
1718 template<class T1 = Weekday>
1719 constexpr const T1 get_weekday(year_t year, int month, int day) {
1720 return day_of_week_date<T1>(year, month, day);
1721 }
1722
1725 template<class T1 = Weekday>
1726 constexpr const T1 get_weekday(year_t year, Month month, int day) {
1727 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1728 }
1729
1732 template<class T1 = Weekday>
1733 constexpr const T1 weekday(year_t year, int month, int day) {
1734 return day_of_week_date<T1>(year, month, day);
1735 }
1736
1739 template<class T1 = Weekday>
1740 constexpr const T1 weekday(year_t year, Month month, int day) {
1741 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1742 }
1743
1746 template<class T1 = Weekday>
1747 constexpr const T1 dow(year_t year, int month, int day) {
1748 return day_of_week_date<T1>(year, month, day);
1749 }
1750
1753 template<class T1 = Weekday>
1754 constexpr const T1 dow(year_t year, Month month, int day) {
1755 return day_of_week_date<T1>(year, static_cast<int>(month), day);
1756 }
1757
1758//------------------------------------------------------------------------------
1759
1763 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1764 constexpr T1 get_dow(const T2& date) {
1765 return get_weekday_from_date<T1>(date);
1766 }
1767
1771 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1772 constexpr T1 dow_from_date(const T2& date) {
1773 return get_weekday_from_date<T1>(date);
1774 }
1775
1779 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1780 constexpr T1 weekday_of(const T2& date) {
1781 return get_weekday_from_date<T1>(date);
1782 }
1783
1787 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1788 constexpr T1 day_of_week_dt(const T2& date) {
1789 return get_weekday_from_date<T1>(date);
1790 }
1791
1795 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1796 constexpr T1 day_of_week(const T2& date) {
1797 return get_weekday_from_date<T1>(date);
1798 }
1799
1803 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value, int>::type = 0>
1804 constexpr T1 dow(const T2& date) {
1805 return get_weekday_from_date<T1>(date);
1806 }
1807
1808//------------------------------------------------------------------------------
1809
1810
1813 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1814 constexpr const T day_of_week(U ts) noexcept {
1815 return get_weekday_from_ts<T>(ts);
1816 }
1817
1820 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1821 constexpr const T dow_ts(U ts) noexcept {
1822 return get_weekday_from_ts<T>(ts);
1823 }
1824
1827 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1828 constexpr const T get_dow_from_ts(U ts) noexcept {
1829 return get_weekday_from_ts<T>(ts);
1830 }
1831
1834 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
1835 constexpr const T weekday_of_ts(U ts) noexcept {
1836 return get_weekday_from_ts<T>(ts);
1837 }
1838
1839//------------------------------------------------------------------------------
1840
1843 template<class T = Weekday>
1844 constexpr const T day_of_week_ms(ts_ms_t ts_ms) {
1846 }
1847
1848//------------------------------------------------------------------------------
1849
1852 TIME_SHIELD_CONSTEXPR inline const ts_t month_begin(ts_t ts = time_shield::ts()) {
1853 return start_of_month(ts);
1854 }
1855
1856//------------------------------------------------------------------------------
1857
1860 TIME_SHIELD_CONSTEXPR inline const ts_t last_day_of_month(ts_t ts = time_shield::ts()) {
1861 return end_of_month(ts);
1862 }
1863
1864//------------------------------------------------------------------------------
1865
1868 TIME_SHIELD_CONSTEXPR inline const ts_t final_sunday_of_month(ts_t ts = time_shield::ts()) {
1869 return last_sunday_of_month(ts);
1870 }
1871
1872//------------------------------------------------------------------------------
1873
1876 template<class T1 = int, class T2 = year_t, class T3 = int>
1877 TIME_SHIELD_CONSTEXPR inline const T1 final_sunday_month_day(T2 year, T3 month) {
1878 return last_sunday_month_day(year, month);
1879 }
1880
1881//------------------------------------------------------------------------------
1882
1885 constexpr const ts_t hour_begin(ts_t ts = time_shield::ts()) noexcept {
1886 return start_of_hour(ts);
1887 }
1888
1889//------------------------------------------------------------------------------
1890
1893 constexpr const ts_t hour_begin_sec(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1894 return start_of_hour_sec(ts_ms);
1895 }
1896
1897//------------------------------------------------------------------------------
1898
1901 constexpr const ts_ms_t hour_begin_ms(ts_ms_t ts_ms = time_shield::ts_ms()) noexcept {
1902 return start_of_hour_ms(ts_ms);
1903 }
1904
1905//------------------------------------------------------------------------------
1906
1909 constexpr const ts_t finish_of_hour(ts_t ts = time_shield::ts()) noexcept {
1910 return end_of_hour(ts);
1911 }
1912
1913//------------------------------------------------------------------------------
1914
1918 return end_of_hour_sec(ts_ms);
1919 }
1920
1921//------------------------------------------------------------------------------
1922
1926 return end_of_hour_ms(ts_ms);
1927 }
1928
1929//------------------------------------------------------------------------------
1930
1933 template<class T = int>
1934 constexpr const T hour_in_day(ts_t ts = time_shield::ts()) noexcept {
1935 return hour_of_day(ts);
1936 }
1937
1938//------------------------------------------------------------------------------
1939
1942 constexpr const ts_t week_begin(ts_t ts = time_shield::ts()) {
1943 return start_of_week(ts);
1944 }
1945
1946//------------------------------------------------------------------------------
1947
1951 return end_of_week(ts);
1952 }
1953
1954//------------------------------------------------------------------------------
1955
1959 return start_of_saturday(ts);
1960 }
1961
1962//------------------------------------------------------------------------------
1963
1966 constexpr const ts_t min_begin(ts_t ts = time_shield::ts()) noexcept {
1967 return start_of_min(ts);
1968 }
1969
1970//------------------------------------------------------------------------------
1971
1974 constexpr const ts_t finish_of_min(ts_t ts = time_shield::ts()) noexcept {
1975 return end_of_min(ts);
1976 }
1977
1979
1980}; // namespace time_shield
1981
1982#endif // _TIME_SHIELD_TIME_CONVERSIONS_ALIASES_HPP_INCLUDED
TIME_SHIELD_CONSTEXPR const T year_ms(ts_ms_t ts_ms=ts_ms())
Alias for get_year_ms function.
TIME_SHIELD_CONSTEXPR const fts_t dt_to_ftimestamp(const T &date_time)
Converts a date-time structure to a floating-point timestamp.
constexpr const 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.
TIME_SHIELD_CONSTEXPR const fts_t tm_to_ftimestamp(const std::tm *timeinfo)
Converts a std::tm structure to a floating-point timestamp.
constexpr const T unix_year(ts_t ts) noexcept
Alias for get_unix_year function.
constexpr T unix_day(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr const T num_days_in_year_ts(ts_t ts=time_shield::ts())
Get the number of days in the current year.
constexpr const T get_unix_day_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Get UNIX day from milliseconds timestamp.
constexpr const ts_t finish_of_week(ts_t ts=time_shield::ts())
Alias for end_of_week function.
constexpr const T uday_to_ts(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
TIME_SHIELD_CONSTEXPR const ts_t to_timestamp_ms(const T &date_time)
Alias for dt_to_timestamp_ms function.
TIME_SHIELD_CONSTEXPR const T to_year_ms(ts_ms_t ts_ms=ts_ms())
Alias for get_year_ms function.
constexpr const 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.
constexpr const 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.
constexpr const 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 get_unixday(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
TIME_SHIELD_CONSTEXPR const 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.
T to_date_time_ms(ts_ms_t ts)
Converts a timestamp in milliseconds to a date-time structure with milliseconds.
constexpr const ts_t finish_of_min(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_min function.
constexpr const ts_t end_of_min(ts_t ts=time_shield::ts()) noexcept
Get the timestamp of the end of the minute.
TIME_SHIELD_CONSTEXPR const ts_t year_start_ms(ts_t ts_ms=time_shield::ts_ms())
Alias for start_of_year_ms function.
constexpr const T next_day_unixday_ms(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
constexpr const T next_day_unixday(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
constexpr const T unixday_to_ts_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr const T dow_ts(U ts) noexcept
Alias for get_weekday_from_ts.
constexpr const ts_t min_begin(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_min function.
constexpr const T hour_in_day(ts_t ts=time_shield::ts()) noexcept
Alias for hour_of_day function.
constexpr const ts_ms_t day_start_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_ms function.
constexpr const T1 weekday(year_t year, int month, int day)
Alias for day_of_week_date.
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 T1 dow_from_date(const T2 &date)
Alias for get_weekday_from_date.
constexpr const 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.
TIME_SHIELD_CONSTEXPR const ts_t year_begin_date(T year)
Alias for start_of_year_date function.
constexpr const T next_day_from_unix_day_ms(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
constexpr const T1 get_weekday_from_date(const T2 &date)
Get the day of the week from a date structure.
constexpr const T get_dow_from_ts(U ts) noexcept
Alias for get_weekday_from_ts.
constexpr const ts_t day_end_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_day_sec function.
constexpr const T next_day_unix_day_ms(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
TIME_SHIELD_CONSTEXPR const ts_t start_of_year_date(T year)
Get the timestamp of the start of the year.
constexpr const ts_t saturday_begin(ts_t ts=time_shield::ts())
Alias for start_of_saturday function.
TIME_SHIELD_CONSTEXPR ts_t ts(year_t year, int month, int day)
Alias for to_timestamp.
TIME_SHIELD_CONSTEXPR const ts_t year_end(ts_t ts=time_shield::ts())
Alias for end_of_year function.
TIME_SHIELD_CONSTEXPR ts_t end_of_year(ts_t ts=time_shield::ts())
Get the end-of-year timestamp.
constexpr const T next_day_from_unix_day(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
constexpr T unix_day_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
TIME_SHIELD_CONSTEXPR const ts_t final_sunday_of_month(ts_t ts=time_shield::ts())
Alias for last_sunday_of_month function.
constexpr const T unix_day_to_ts(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
constexpr T uday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
constexpr const ts_t hour_begin(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_hour function.
constexpr const T1 get_weekday(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR const ts_t tm_to_timestamp_ms(const std::tm *timeinfo)
Converts a std::tm structure to a timestamp in milliseconds.
constexpr const ts_t next_day_start(ts_t ts, T days=1) noexcept
Alias for start_of_next_day function.
constexpr T1 weekday_of(const T2 &date)
Alias for get_weekday_from_date.
TIME_SHIELD_CONSTEXPR const ts_ms_t year_end_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for end_of_year_ms function.
TIME_SHIELD_CONSTEXPR ts_t to_ts(year_t year, int month, int day)
Alias for to_timestamp.
constexpr const ts_t start_day_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_sec function.
constexpr const ts_t end_of_week(ts_t ts=time_shield::ts())
Get the timestamp of the end of the week.
T to_dt_struct_ms(ts_ms_t ts)
Alias for to_date_time_ms function.
constexpr const ts_ms_t day_end_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_day_ms function.
constexpr const ts_t day_start_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_sec function.
constexpr const ts_t start_of_hour(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the start of the hour.
TIME_SHIELD_CONSTEXPR const ts_ms_t start_of_year_date_ms(T year)
Get the timestamp in milliseconds of the start of the year.
constexpr const T get_days_difference(ts_t start, ts_t stop) noexcept
Get the number of days between two timestamps.
constexpr const 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 const ts_ms_t year_start_date_ms(T year)
Alias for start_of_year_date_ms function.
constexpr ts_t ts_from_tm(const std::tm *timeinfo)
Alias for tm_to_timestamp.
constexpr const T1 num_days_in_month(ts_t ts=time_shield::ts()) noexcept
Alias for num_days_in_month_ts function.
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.
constexpr const T1 day_of_week(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR const ts_t start_of_month(ts_t ts=time_shield::ts())
Get the timestamp at the start of the current month.
constexpr const T1 dow(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR const T1 last_sunday_month_day(T2 year, T3 month)
Get the day of the last Sunday of the given month and year.
constexpr const T unixday_to_ts(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
TIME_SHIELD_CONSTEXPR const T to_year(ts_t ts=ts())
Alias for get_year function.
TIME_SHIELD_CONSTEXPR const 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.
constexpr const T get_unix_year(ts_t ts) noexcept
Converts a UNIX timestamp to a year.
constexpr const T unix_min(ts_t ts=ts())
Alias for get_unix_min function.
constexpr const ts_t finish_of_hour(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_hour function.
constexpr const ts_t week_begin(ts_t ts=time_shield::ts())
Alias for start_of_week function.
constexpr const T to_unix_year(ts_t ts) noexcept
Alias for get_unix_year function.
constexpr const T1 day_of_week_date(T2 year, T3 month, T4 day)
Get the day of the week.
constexpr const T get_weekday_from_ts(ts_t ts) noexcept
Get the weekday from a timestamp.
constexpr const ts_ms_t finish_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_hour_ms function.
T1 to_dt_struct(T2 ts)
Alias for to_date_time function.
TIME_SHIELD_CONSTEXPR ts_t get_ts(year_t year, int month, int day)
Alias for to_timestamp.
constexpr const 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.
constexpr const ts_t finish_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_hour_sec function.
TIME_SHIELD_CONSTEXPR const ts_t dt_to_timestamp(const T &date_time)
Converts a date-time structure to a timestamp.
constexpr fts_t to_ftimestamp(const T &date_time)
Alias for dt_to_ftimestamp.
TIME_SHIELD_CONSTEXPR const ts_t last_day_of_month(ts_t ts=time_shield::ts())
Alias for end_of_month function.
TIME_SHIELD_CONSTEXPR ts_t get_timestamp(year_t year, int month, int day)
Alias for to_timestamp.
TIME_SHIELD_CONSTEXPR const ts_ms_t year_begin_date_ms(T year)
Alias for start_of_year_date_ms function.
constexpr const T get_unix_day(ts_t ts=time_shield::ts()) noexcept
Get UNIX day.
T to_dt_ms(ts_ms_t ts)
Alias for to_date_time_ms function.
TIME_SHIELD_CONSTEXPR const T hour24_to_12(T hour) noexcept
Converts a 24-hour format hour to a 12-hour format.
TIME_SHIELD_CONSTEXPR const ts_t year_start_date(T year)
Alias for start_of_year_date function.
constexpr const T1 days_in_year(T2 year) noexcept
Alias for num_days_in_year function.
constexpr const T unix_day_to_ts_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr const T start_of_day_from_unix_day_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr const T unix_day_to_timestamp(uday_t unix_day) noexcept
Converts a UNIX day to a timestamp in seconds.
constexpr ts_ms_t ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr const 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.
constexpr const T get_weekday_from_ts_ms(ts_ms_t ts_ms)
Get the weekday from a timestamp in milliseconds.
constexpr const T umin(ts_t ts=ts())
Alias for get_unix_min function.
constexpr const ts_t start_of_min(ts_t ts=time_shield::ts()) noexcept
Get the timestamp of the beginning of the minute.
TIME_SHIELD_CONSTEXPR const ts_t tm_to_timestamp(const std::tm *timeinfo)
Converts a std::tm structure to a timestamp.
constexpr const T unix_day_to_timestamp_ms(uday_t unix_day) noexcept
Converts a UNIX day to a timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR const T1 final_sunday_month_day(T2 year, T3 month)
Alias for last_sunday_month_day function.
constexpr const ts_t hour_begin_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_hour_sec function.
constexpr const 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.
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 const ts_t year_begin_ms(ts_t ts_ms=time_shield::ts_ms())
Alias for start_of_year_ms function.
constexpr const T days_in_year_ts(ts_t ts=time_shield::ts())
Alias for num_days_in_year_ts function.
constexpr ts_ms_t get_ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr const 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 const T get_year_ms(ts_ms_t ts_ms=ts_ms())
Get the year from the timestamp in milliseconds.
T1 to_date_time(T2 ts)
Converts a timestamp to a date-time structure.
constexpr const ts_t end_of_day(const ts_t &ts=time_shield::ts()) noexcept
Get the timestamp at the end of the day.
constexpr T unixday(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr const T next_day_unix_day(uday_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
TIME_SHIELD_CONSTEXPR const ts_ms_t end_of_year_ms(ts_ms_t ts_ms=ts_ms())
Get the timestamp in milliseconds of the end of the year.
TIME_SHIELD_CONSTEXPR const ts_t year_start(ts_t ts=time_shield::ts())
Alias for start_of_year function.
constexpr const 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.
TIME_SHIELD_CONSTEXPR const T get_year(ts_t ts=ts())
Get the year from the timestamp.
constexpr const T1 num_days_in_year(T2 year) noexcept
Get the number of days in a given year.
constexpr const T weekday_of_ts(U ts) noexcept
Alias for get_weekday_from_ts.
TIME_SHIELD_CONSTEXPR const ts_t dt_to_timestamp_ms(const T &date_time)
Converts a date-time structure to a timestamp in milliseconds.
constexpr const ts_t day_start(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_day function.
constexpr const 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.
TIME_SHIELD_CONSTEXPR const T year(ts_t ts=ts())
Alias for get_year function.
constexpr const T to_unix_min(ts_t ts=ts())
Alias for get_unix_min function.
constexpr const T get_unix_min(ts_t ts=ts())
Get UNIX minute.
constexpr const T start_of_day_from_unix_day(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp function.
constexpr const T days(ts_t start, ts_t stop) noexcept
Alias for get_days_difference function.
TIME_SHIELD_CONSTEXPR const ts_t to_timestamp(const T &date_time)
Alias for dt_to_timestamp function.
constexpr const ts_t start_of_day(ts_t ts=time_shield::ts()) noexcept
Get the start of the day timestamp.
TIME_SHIELD_CONSTEXPR const ts_t start_of_year(ts_t ts) noexcept
Get the start of the year timestamp.
constexpr const 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 ts_ms_t to_ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
T1 to_dt(T2 ts)
Alias for to_date_time function.
constexpr const ts_t day_end(const ts_t &ts=time_shield::ts()) noexcept
Alias for end_of_day function.
TIME_SHIELD_CONSTEXPR const T h24_to_h12(T hour) noexcept
Alias for hour24_to_12 function.
constexpr const ts_t start_of_saturday(ts_t ts=time_shield::ts())
Get the timestamp of the start of Saturday.
TIME_SHIELD_CONSTEXPR const ts_t end_of_month(ts_t ts=time_shield::ts())
Get the last timestamp of the current month.
constexpr const T uday_to_ts_ms(uday_t unix_day) noexcept
Alias for unix_day_to_timestamp_ms function.
constexpr ts_ms_t get_timestamp_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr const T1 days_in_month(T2 year, T3 month) noexcept
Alias for num_days_in_month function.
constexpr const 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 const T hour_of_day(ts_t ts=time_shield::ts()) noexcept
Get the hour of the day.
constexpr const T get_days(ts_t start, ts_t stop) noexcept
Alias for get_days_difference function.
constexpr T1 day_of_week_dt(const T2 &date)
Alias for get_weekday_from_date.
constexpr const T day_of_week_ms(ts_ms_t ts_ms)
Alias for get_weekday_from_ts_ms function.
constexpr const ts_t start_of_week(ts_t ts=time_shield::ts())
Get the timestamp of the beginning of the week.
TIME_SHIELD_CONSTEXPR const ts_t month_begin(ts_t ts=time_shield::ts())
Alias for start_of_month function.
TIME_SHIELD_CONSTEXPR const ts_t year_begin(ts_t ts=time_shield::ts())
Alias for start_of_year function.
constexpr T get_unixday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for get_unix_day_ms function.
constexpr T uday(ts_t ts=time_shield::ts()) noexcept
Alias for get_unix_day function.
constexpr const T1 ms_to_sec(T2 ts_ms) noexcept
Converts a timestamp from milliseconds to seconds.
constexpr const ts_t previous_day_start(ts_t ts=time_shield::ts(), T days=1) noexcept
Alias for start_of_prev_day function.
constexpr const ts_ms_t next_day_start_ms(ts_ms_t ts_ms, T days=1) noexcept
Alias for start_of_next_day_ms function.
int64_t ts_t
Unix timestamp in seconds since 1970‑01‑01T00:00:00Z.
Definition types.hpp:45
int64_t ts_ms_t
Unix timestamp in milliseconds since epoch.
Definition types.hpp:46
int64_t uday_t
Unix day count since 1970‑01‑01 (days since epoch).
Definition types.hpp:41
double fts_t
Floating-point timestamp (fractional seconds since epoch).
Definition types.hpp:48
int64_t year_t
Year as an integer (e.g., 2024).
Definition types.hpp:40
const ts_t ts() noexcept
Get the current UTC timestamp in seconds.
const ts_t timestamp() noexcept
Get the current UTC timestamp in seconds.
const fts_t ftimestamp() noexcept
Get the current UTC timestamp in floating-point seconds.
const ts_ms_t ts_ms() noexcept
Get the current UTC timestamp in milliseconds.
const ts_ms_t timestamp_ms() noexcept
Get the current UTC timestamp in milliseconds.
const fts_t fts() noexcept
Get the current UTC timestamp in floating-point seconds.
Main namespace for the Time Shield library.