Boost.Locale
date_time.hpp
1//
2// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3//
4// Distributed under the Boost Software License, Version 1.0.
5// https://www.boost.org/LICENSE_1_0.txt
6
7#ifndef BOOST_LOCALE_DATE_TIME_HPP_INCLUDED
8#define BOOST_LOCALE_DATE_TIME_HPP_INCLUDED
9
10#include <boost/locale/date_time_facet.hpp>
11#include <boost/locale/formatting.hpp>
12#include <boost/locale/hold_ptr.hpp>
13#include <boost/locale/time_zone.hpp>
14#include <array>
15#include <locale>
16#include <stdexcept>
17#include <vector>
18
19#ifdef BOOST_MSVC
20# pragma warning(push)
21# pragma warning(disable : 4275 4251 4231 4660)
22#endif
23
24namespace boost { namespace locale {
29
31 class BOOST_SYMBOL_VISIBLE date_time_error : public std::runtime_error {
32 public:
34 date_time_error(const std::string& e) : std::runtime_error(e) {}
35 };
36
45 int value;
47 date_time_period operator+() const { return *this; }
50
53 };
54
55 namespace period {
58 {
60 }
63 {
64 return period_type(marks::era);
65 }
68 {
70 }
73 {
75 }
78 {
80 }
83 {
84 return period_type(marks::day);
85 }
88 {
90 }
98 {
100 }
104 {
106 }
109 {
111 }
114 {
115 return period_type(marks::hour);
116 }
119 {
121 }
124 {
126 }
129 {
131 }
134 {
136 }
139 {
141 }
144 {
146 }
149 {
151 }
152
154 inline date_time_period era(int v)
155 {
156 return date_time_period(era(), v);
157 }
159 inline date_time_period year(int v)
160 {
161 return date_time_period(year(), v);
162 }
165 {
166 return date_time_period(extended_year(), v);
167 }
170 {
171 return date_time_period(month(), v);
172 }
174 inline date_time_period day(int v)
175 {
176 return date_time_period(day(), v);
177 }
180 {
181 return date_time_period(day_of_year(), v);
182 }
190 {
191 return date_time_period(day_of_week(), v);
192 }
196 {
198 }
201 {
203 }
205 inline date_time_period hour(int v)
206 {
207 return date_time_period(hour(), v);
208 }
211 {
212 return date_time_period(hour_12(), v);
213 }
216 {
217 return date_time_period(am_pm(), v);
218 }
221 {
222 return date_time_period(minute(), v);
223 }
226 {
227 return date_time_period(second(), v);
228 }
231 {
232 return date_time_period(week_of_year(), v);
233 }
236 {
237 return date_time_period(week_of_month(), v);
238 }
241 {
243 }
244
247 {
248 return date_time_period(month(), 0);
249 }
252 {
253 return date_time_period(month(), 1);
254 }
257 {
258 return date_time_period(month(), 2);
259 }
262 {
263 return date_time_period(month(), 3);
264 }
267 {
268 return date_time_period(month(), 4);
269 }
272 {
273 return date_time_period(month(), 5);
274 }
277 {
278 return date_time_period(month(), 6);
279 }
282 {
283 return date_time_period(month(), 7);
284 }
287 {
288 return date_time_period(month(), 8);
289 }
292 {
293 return date_time_period(month(), 9);
294 }
297 {
298 return date_time_period(month(), 10);
299 }
302 {
303 return date_time_period(month(), 11);
304 }
305
308 {
309 return date_time_period(day_of_week(), 1);
310 }
313 {
314 return date_time_period(day_of_week(), 2);
315 }
318 {
319 return date_time_period(day_of_week(), 3);
320 }
323 {
324 return date_time_period(day_of_week(), 4);
325 }
328 {
329 return date_time_period(day_of_week(), 5);
330 }
333 {
334 return date_time_period(day_of_week(), 6);
335 }
338 {
339 return date_time_period(day_of_week(), 7);
340 }
343 {
344 return date_time_period(am_pm(), 0);
345 }
348 {
349 return date_time_period(am_pm(), 1);
350 }
351
354 {
355 return date_time_period(f);
356 }
359 {
360 return date_time_period(f, -1);
361 }
362
364 template<typename T>
366 {
367 return date_time_period(f, v);
368 }
369
371 template<typename T>
373 {
374 return date_time_period(f, v);
375 }
377 template<typename T>
379 {
380 return date_time_period(f.type, f.value * v);
381 }
382
384 template<typename T>
386 {
387 return date_time_period(f.type, f.value * v);
388 }
389
390 } // namespace period
391
397 public:
400
403
405 date_time_period_set(const date_time_period& fl) { basic_[0] = fl; }
406
409 {
410 const size_t n = size();
411 if(n < basic_.size())
412 basic_[n] = f;
413 else
414 periods_.push_back(f);
415 }
416
418 size_t size() const
419 {
420 for(size_t i = 0; i < basic_.size(); ++i) {
421 if(basic_[i].type == period::period_type())
422 return i;
423 }
424 return basic_.size() + periods_.size();
425 }
426
428 const date_time_period& operator[](size_t n) const
429 {
430 if(n >= size())
431 throw std::out_of_range("Invalid index to date_time_period");
432 if(n < basic_.size())
433 return basic_[n];
434 else
435 return periods_[n - basic_.size()];
436 }
437
438 private:
439 std::array<date_time_period, 4> basic_;
440 std::vector<date_time_period> periods_;
441 };
442
445 {
447 for(unsigned i = 0; i < b.size(); i++)
448 s.add(b[i]);
449 return s;
450 }
451
454 {
456 for(unsigned i = 0; i < b.size(); i++)
457 s.add(-b[i]);
458 return s;
459 }
460
466 class BOOST_LOCALE_DECL calendar {
467 public:
472 calendar(std::ios_base& ios);
473
477 calendar(const std::locale& l, const std::string& zone);
478
482 calendar(const std::locale& l);
483
487
488 calendar(const std::string& zone);
489
494 ~calendar();
495
497 calendar(const calendar& other);
500
510
512 int first_day_of_week() const;
513
515 const std::locale& get_locale() const;
517 const std::string& get_time_zone() const;
518
520 bool is_gregorian() const;
521
523 bool operator==(const calendar& other) const;
525 bool operator!=(const calendar& other) const;
526
527 private:
528 friend class date_time;
529 std::locale locale_;
530 std::string tz_;
532 };
533
557
558 class BOOST_LOCALE_DECL date_time {
559 public:
564
566 date_time(const date_time& other);
567 // Move construct a date_time
568 date_time(date_time&&) noexcept = default;
569
571 date_time(const date_time& other, const date_time_period_set& set);
572
574 date_time& operator=(const date_time& other);
575 // Move assign a date_time
576 date_time& operator=(date_time&&) noexcept = default;
577
581 date_time(double time);
582
584 date_time(double time, const calendar& cal);
585
587 date_time(const calendar& cal);
588
593
595 date_time(const date_time_period_set& set, const calendar& cal);
596
598 date_time& operator=(const date_time_period_set& f);
599
601 void set(period::period_type f, int v);
602
604 int get(period::period_type f) const;
606 int operator/(period::period_type f) const { return get(f); }
607
616
625
634
643
652
661
665 double time() const;
670 void time(double v);
671
673 std::string timezone() const;
674
676 bool operator==(const date_time& other) const;
678 bool operator!=(const date_time& other) const;
680 bool operator<(const date_time& other) const;
682 bool operator>(const date_time& other) const;
684 bool operator<=(const date_time& other) const;
686 bool operator>=(const date_time& other) const;
687
689 void swap(date_time& other) noexcept;
690
692 int difference(const date_time& other, period::period_type f) const;
693
699
702
703 private:
705 };
706
707 inline void swap(date_time& left, date_time& right) noexcept
708 {
709 left.swap(right);
710 }
711
723 template<typename CharType>
724 std::basic_ostream<CharType>& operator<<(std::basic_ostream<CharType>& out, const date_time& t)
725 {
726 const double time_point = t.time();
727 ios_info& info = ios_info::get(out);
728 const uint64_t display_flags = info.display_flags();
729 if(as::detail::is_datetime_display_flags(display_flags)) {
730 out << time_point;
731 } else {
732 info.display_flags(flags::datetime);
733 out << time_point;
734 info.display_flags(display_flags);
735 }
736 return out;
737 }
738
742 template<typename CharType>
743 std::basic_istream<CharType>& operator>>(std::basic_istream<CharType>& in, date_time& t)
744 {
745 double v;
746 const uint64_t display_flags = ios_info::get(in).display_flags();
747 if(as::detail::is_datetime_display_flags(display_flags)) {
748 in >> v;
749 } else {
750 ios_info::get(in).display_flags(flags::datetime);
751 in >> v;
752 ios_info::get(in).display_flags(display_flags);
753 }
754 if(!in.fail())
755 t.time(v);
756 return in;
757 }
758
759#ifdef BOOST_MSVC
760# pragma warning(push)
761# pragma warning(disable : 4512) // assignment operator could not be generated
762#endif
763
771 public:
774 date_time_duration(const date_time& first, const date_time& second) : s_(first), e_(second) {}
775
777 int get(period::period_type f) const { return start().difference(end(), f); }
779 int operator/(period::period_type f) const { return start().difference(end(), f); }
780
782 const date_time& start() const { return s_; }
784 const date_time& end() const { return e_; }
785
786 private:
787 const date_time& s_;
788 const date_time& e_;
789 };
790#ifdef BOOST_MSVC
791# pragma warning(pop)
792#endif
793
796 inline date_time_duration operator-(const date_time& later, const date_time& earlier)
797 {
798 return date_time_duration(earlier, later);
799 }
800
801 namespace period {
803 inline int era(const date_time& dt)
804 {
805 return dt.get(era());
806 }
809 inline int year(const date_time& dt)
810 {
811 return dt.get(year());
812 }
815 inline int extended_year(const date_time& dt)
816 {
817 return dt.get(extended_year());
818 }
820 inline int month(const date_time& dt)
821 {
822 return dt.get(month());
823 }
825 inline int day(const date_time& dt)
826 {
827 return dt.get(day());
828 }
830 inline int day_of_year(const date_time& dt)
831 {
832 return dt.get(day_of_year());
833 }
840 inline int day_of_week(const date_time& dt)
841 {
842 return dt.get(day_of_week());
843 }
847 inline int day_of_week_in_month(const date_time& dt)
848 {
849 return dt.get(day_of_week_in_month());
850 }
853 inline int day_of_week_local(const date_time& dt)
854 {
855 return dt.get(day_of_week_local());
856 }
858 inline int hour(const date_time& dt)
859 {
860 return dt.get(hour());
861 }
863 inline int hour_12(const date_time& dt)
864 {
865 return dt.get(hour_12());
866 }
868 inline int am_pm(const date_time& dt)
869 {
870 return dt.get(am_pm());
871 }
873 inline int minute(const date_time& dt)
874 {
875 return dt.get(minute());
876 }
878 inline int second(const date_time& dt)
879 {
880 return dt.get(second());
881 }
883 inline int week_of_year(const date_time& dt)
884 {
885 return dt.get(week_of_year());
886 }
888 inline int week_of_month(const date_time& dt)
889 {
890 return dt.get(week_of_month());
891 }
894 inline int first_day_of_week(const date_time& dt)
895 {
896 return dt.get(first_day_of_week());
897 }
898
901 inline int era(const date_time_duration& dt)
902 {
903 return dt.get(era());
904 }
906 inline int year(const date_time_duration& dt)
907 {
908 return dt.get(year());
909 }
912 inline int extended_year(const date_time_duration& dt)
913 {
914 return dt.get(extended_year());
915 }
917 inline int month(const date_time_duration& dt)
918 {
919 return dt.get(month());
920 }
922 inline int day(const date_time_duration& dt)
923 {
924 return dt.get(day());
925 }
927 inline int day_of_year(const date_time_duration& dt)
928 {
929 return dt.get(day_of_year());
930 }
932 inline int day_of_week(const date_time_duration& dt)
933 {
934 return dt.get(day_of_week());
935 }
939 {
940 return dt.get(day_of_week_in_month());
941 }
944 {
945 return dt.get(day_of_week_local());
946 }
948 inline int hour(const date_time_duration& dt)
949 {
950 return dt.get(hour());
951 }
953 inline int hour_12(const date_time_duration& dt)
954 {
955 return dt.get(hour_12());
956 }
958 inline int am_pm(const date_time_duration& dt)
959 {
960 return dt.get(am_pm());
961 }
963 inline int minute(const date_time_duration& dt)
964 {
965 return dt.get(minute());
966 }
968 inline int second(const date_time_duration& dt)
969 {
970 return dt.get(second());
971 }
973 inline int week_of_year(const date_time_duration& dt)
974 {
975 return dt.get(week_of_year());
976 }
978 inline int week_of_month(const date_time_duration& dt)
979 {
980 return dt.get(week_of_month());
981 }
984 {
985 return dt.get(first_day_of_week());
986 }
987
988 } // namespace period
989
991
992}} // namespace boost::locale
993
994#ifdef BOOST_MSVC
995# pragma warning(pop)
996#endif
997
1003
1004#endif
this class provides an access to general calendar information.
Definition: date_time.hpp:466
const std::string & get_time_zone() const
get calendar's time zone
calendar(const std::string &zone)
int greatest_minimum(period::period_type f) const
int maximum(period::period_type f) const
Get maximum value for period f, For example for Gregorian calendar's maximum period::day it is 31.
calendar & operator=(const calendar &other)
assign calendar
bool is_gregorian() const
Check if the calendar is Gregorian.
int least_maximum(period::period_type f) const
Get least maximum value for period f, For example for Gregorian calendar's maximum period::day it is ...
bool operator==(const calendar &other) const
Compare calendars for equivalence: i.e. calendar types, time zones etc.
int first_day_of_week() const
Get first day of week for specific calendar, for example for US it is 1 - Sunday for France it is 2 -...
int minimum(period::period_type f) const
Get minimum value for period f, For example for period::day it is 1.
calendar(std::ios_base &ios)
calendar(const std::locale &l)
calendar(const calendar &other)
copy calendar
bool operator!=(const calendar &other) const
Opposite of ==.
calendar(const std::locale &l, const std::string &zone)
const std::locale & get_locale() const
get calendar's locale
This class represents a period: a pair of two date_time objects.
Definition: date_time.hpp:770
const date_time & start() const
Get starting point.
Definition: date_time.hpp:782
date_time_duration(const date_time &first, const date_time &second)
Definition: date_time.hpp:774
const date_time & end() const
Get ending point.
Definition: date_time.hpp:784
int operator/(period::period_type f) const
Syntactic sugar for get(f)
Definition: date_time.hpp:779
int get(period::period_type f) const
find a difference in terms of period_type f
Definition: date_time.hpp:777
This error is thrown in case of invalid state that occurred.
Definition: date_time.hpp:31
date_time_error(const std::string &e)
Constructor of date_time_error class.
Definition: date_time.hpp:34
This class represents a set of periods.
Definition: date_time.hpp:396
date_time_period_set(period::period_type f)
Create a set of single period with value 1.
Definition: date_time.hpp:402
date_time_period_set()=default
Default constructor - empty set.
void add(date_time_period f)
Append date_time_period f to the set.
Definition: date_time.hpp:408
size_t size() const
Get number of items in list.
Definition: date_time.hpp:418
date_time_period_set(const date_time_period &fl)
Create a set of single period fl.
Definition: date_time.hpp:405
const date_time_period & operator[](size_t n) const
Get item at position n the set, n should be in range [0,size)
Definition: date_time.hpp:428
this class represents a date time and allows to perform various operation according to the locale set...
Definition: date_time.hpp:558
date_time operator-(const date_time_period &v) const
subtract date_time_period from the current date_time
bool operator>(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time & operator-=(const date_time_period_set &v)
subtract date_time_period_set v from the current date_time
date_time & operator-=(const date_time_period &v)
subtract date_time_period from the current date_time
date_time & operator+=(const date_time_period_set &v)
add date_time_period_set v to the current date_time
date_time operator+(period::period_type f) const
add single period f to the current date_time
Definition: date_time.hpp:609
date_time & operator>>=(const date_time_period &v)
roll current date_time backward by date_time_period v
date_time operator>>(const date_time_period_set &v) const
roll current date_time backward by date_time_period_set v
bool operator<=(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time(const date_time &other)
Copy a date_time.
std::string timezone() const
Get the name of the associated timezone.
bool is_in_daylight_saving_time() const
Check if *this time point is in daylight saving time.
date_time operator+(const date_time_period &v) const
add date_time_period to the current date_time
date_time operator>>(period::period_type f) const
roll backward a date by single period f.
Definition: date_time.hpp:620
bool operator<(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
int difference(const date_time &other, period::period_type f) const
calculate the distance from this date_time to other in terms of periods f
date_time operator+(const date_time_period_set &v) const
add date_time_period_set v to the current date_time
date_time & operator<<=(const date_time_period &v)
roll current date_time forward by date_time_period v
bool operator!=(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time operator>>(const date_time_period &v) const
roll current date_time backward by date_time_period v
date_time operator<<(const date_time_period_set &v) const
roll current date_time forward by date_time_period_set v
date_time & operator-=(period::period_type f)
subtract single period f from the current date_time
Definition: date_time.hpp:615
int get(period::period_type f) const
get specific period f value
bool operator>=(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time operator<<(period::period_type f) const
roll forward a date by single period f.
Definition: date_time.hpp:618
int minimum(period::period_type f) const
Get minimal possible value for *this time point for a period f.
date_time & operator+=(const date_time_period &v)
add date_time_period to the current date_time
int maximum(period::period_type f) const
date_time & operator>>=(const date_time_period_set &v)
roll current date_time backward by date_time_period_set v
bool operator==(const date_time &other) const
compare date_time in the timeline (ignores difference in calendar, timezone etc)
date_time & operator+=(period::period_type f)
add single period f to the current date_time
Definition: date_time.hpp:613
date_time & operator<<=(period::period_type f)
roll forward a date by single period f.
Definition: date_time.hpp:622
date_time & operator>>=(period::period_type f)
roll backward a date by single period f.
Definition: date_time.hpp:624
void swap(date_time &other) noexcept
swaps two dates - efficient, does not throw
date_time operator-(period::period_type f) const
subtract single period f from the current date_time
Definition: date_time.hpp:611
date_time operator-(const date_time_period_set &v) const
subtract date_time_period_set v from the current date_time
date_time & operator<<=(const date_time_period_set &v)
roll current date_time forward by date_time_period_set v
date_time operator<<(const date_time_period &v) const
roll current date_time forward by date_time_period v
a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the po...
Definition: hold_ptr.hpp:17
void display_flags(uint64_t flags)
Set flags that define how to format data, e.g. number, spell, currency etc.
static ios_info & get(std::ios_base &ios)
Get ios_info instance for specific stream object.
This class holds a type that represents certain period of time like year, hour, second and so on.
Definition: date_time_facet.hpp:66
date_time_period_set operator-(const date_time_period_set &a, const date_time_period_set &b)
Append two period sets when all periods of set change their sign.
Definition: date_time.hpp:453
date_time_period_set operator+(const date_time_period_set &a, const date_time_period_set &b)
Append two periods sets. Note this operator is not commutative.
Definition: date_time.hpp:444
std::basic_ostream< CharType > & operator<<(std::basic_ostream< CharType > &out, const date_time &t)
Definition: date_time.hpp:724
std::basic_istream< CharType > & operator>>(std::basic_istream< CharType > &in, date_time &t)
Definition: date_time.hpp:743
@ day_of_week_local
Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7].
Definition: date_time_facet.hpp:44
@ month
The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time_facet.hpp:34
@ minute
minute [0..59]
Definition: date_time_facet.hpp:48
@ hour_12
12 clock hour [0..11]
Definition: date_time_facet.hpp:46
@ second
second [0..59]
Definition: date_time_facet.hpp:49
@ year
Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time_facet.hpp:32
@ day_of_year
The number of day in year, starting from 1, in Gregorian [1..366].
Definition: date_time_facet.hpp:36
@ week_of_year
The week number in the year.
Definition: date_time_facet.hpp:50
@ extended_year
Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1.
Definition: date_time_facet.hpp:33
@ hour
24 clock hour [0..23]
Definition: date_time_facet.hpp:45
@ am_pm
am or pm marker [0..1]
Definition: date_time_facet.hpp:47
@ first_day_of_week
First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time_facet.hpp:52
@ week_of_month
The week number within current month.
Definition: date_time_facet.hpp:51
@ invalid
Special invalid value, should not be used directly.
Definition: date_time_facet.hpp:30
@ day
The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time_facet.hpp:35
@ era
Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time_facet.hpp:31
@ day_of_week_in_month
Definition: date_time_facet.hpp:42
@ day_of_week
Definition: date_time_facet.hpp:37
period_type minute()
Get period_type for: minute [0..59].
Definition: date_time.hpp:128
period_type day_of_week_in_month()
Definition: date_time.hpp:103
date_time_period sunday()
Get predefined constant for Sunday.
Definition: date_time.hpp:307
date_time_period operator+(period::period_type f)
convert period_type to date_time_period(f,1)
Definition: date_time.hpp:353
period_type first_day_of_week()
Get period_type for: First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time.hpp:148
date_time_period april()
Get predefined constant for April.
Definition: date_time.hpp:261
date_time_period tuesday()
Get predefined constant for Tuesday.
Definition: date_time.hpp:317
date_time_period friday()
Get predefined constant for Friday.
Definition: date_time.hpp:332
period_type day_of_year()
Get period_type for: The number of day in year, starting from 1, in Gregorian [1.....
Definition: date_time.hpp:87
period_type hour()
Get period_type for: 24 clock hour [0..23].
Definition: date_time.hpp:113
date_time_period july()
Get predefined constant for July.
Definition: date_time.hpp:276
date_time_period may()
Get predefined constant for May.
Definition: date_time.hpp:266
date_time_period monday()
Get predefined constant for Monday.
Definition: date_time.hpp:312
period_type week_of_year()
Get period_type for: The week number in the year.
Definition: date_time.hpp:138
period_type day_of_week_local()
Get period_type for: Local day of week, for example in France Monday is 1, in US Sunday is 1,...
Definition: date_time.hpp:108
date_time_period pm()
Get predefined constant for PM (Post Meridiem)
Definition: date_time.hpp:347
date_time_period january()
Get predefined constant for January.
Definition: date_time.hpp:246
period_type am_pm()
Get period_type for: am or pm marker [0..1].
Definition: date_time.hpp:123
period_type era()
Get period_type for: Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time.hpp:62
period_type invalid()
Get period_type for: special invalid value, should not be used directly.
Definition: date_time.hpp:57
date_time_period am()
Get predefined constant for AM (Ante Meridiem)
Definition: date_time.hpp:342
period_type day()
Get period_type for: The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time.hpp:82
date_time_period wednesday()
Get predefined constant for Wednesday.
Definition: date_time.hpp:322
date_time_period operator-(period::period_type f)
convert period_type to date_time_period(f,-1)
Definition: date_time.hpp:358
period_type year()
Get period_type for: Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time.hpp:67
period_type month()
Get period_type for: The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time.hpp:77
date_time_period december()
Get predefined constant for December.
Definition: date_time.hpp:301
period_type week_of_month()
Get period_type for: The week number within current month.
Definition: date_time.hpp:143
date_time_period thursday()
Get predefined constant for Thursday.
Definition: date_time.hpp:327
date_time_period february()
Get predefined constant for February.
Definition: date_time.hpp:251
date_time_period november()
Get predefined constant for November.
Definition: date_time.hpp:296
date_time_period august()
Get predefined constant for August.
Definition: date_time.hpp:281
date_time_period june()
Get predefined constant for June.
Definition: date_time.hpp:271
date_time_period march()
Get predefined constant for March.
Definition: date_time.hpp:256
date_time_period saturday()
Get predefined constant for Saturday.
Definition: date_time.hpp:337
period_type day_of_week()
Definition: date_time.hpp:97
date_time_period october()
Get predefined constant for October.
Definition: date_time.hpp:291
date_time_period september()
Get predefined constant for September.
Definition: date_time.hpp:286
date_time_period operator*(period::period_type f, T v)
Create date_time_period of type f with value v.
Definition: date_time.hpp:365
period_type second()
Get period_type for: second [0..59].
Definition: date_time.hpp:133
period_type extended_year()
Get period_type for: Extended year for Gregorian/Julian calendars, where 1 BC == 0,...
Definition: date_time.hpp:72
period_type hour_12()
Get period_type for: 12 clock hour [0..11].
Definition: date_time.hpp:118
This class represents a pair of period_type and the integer values that describes its amount....
Definition: date_time.hpp:43
date_time_period operator-() const
Operator -, switches the sign of period.
Definition: date_time.hpp:49
date_time_period operator+() const
Operator + returns copy of itself.
Definition: date_time.hpp:47
date_time_period(period::period_type f=period::period_type(), int v=1)
Constructor that creates date_time_period from period_type f and a value v – default 1.
Definition: date_time.hpp:52
period::period_type type
The type of period, i.e. era, year, day etc.
Definition: date_time.hpp:44
int value
Definition: date_time.hpp:45