#include <TimeOfDay.h>
Public Types | |
enum class | NonStandardPrintFormat : uint8_t |
NonStandardPrintFormat is a representation which a TimeOfDay can be transformed into. More... | |
Public Member Functions | |
constexpr | TimeOfDay (TimeOfDay &&src) noexcept=default |
nonvirtual constexpr uint32_t | GetAsSecondsCount () const |
nonvirtual constexpr uint8_t | GetHours () const |
nonvirtual constexpr uint8_t | GetMinutes () const |
nonvirtual constexpr uint8_t | GetSeconds () const |
nonvirtual String | Format (NonStandardPrintFormat pf=NonStandardPrintFormat::eDEFAULT) const |
nonvirtual String | ToString () const |
Static Public Member Functions | |
static TimeOfDay | Parse (const String &rep, const locale &l=locale{}) |
static optional< TimeOfDay > | ParseQuietly (const String &rep, const String &formatPattern) |
like Parse(), but returns nullopt on parse error, not throwing exception. if locale is missing, and formatPattern is not locale independent, the current locale (locale{}) is used. if rep is empty, this will return nullopt | |
Static Public Attributes | |
static constexpr uint32_t | kMaxSecondsPerDay = 60 * 60 * 24u |
static constexpr string_view | kISO8601Format = "%T"sv |
static constexpr string_view | kLocaleStandardFormat = "%X"sv |
static constexpr string_view | kLocaleStandardAlternateFormat = "%EX"sv |
static const Traversal::Iterable< String > | kDefaultParseFormats |
static const TimeOfDay | kMin {0} |
static const TimeOfDay | kMax {TimeOfDay::kMaxSecondsPerDay - 1} |
Description: A time value - which is assumed to be within a given day - e.g 2:30 pm.
TimeOfDay precision is up to the second (use TimePointSeconds for more precision).
Definition at line 63 of file TimeOfDay.h.
|
strong |
NonStandardPrintFormat is a representation which a TimeOfDay can be transformed into.
eCurrentLocale_WithZerosStripped eCurrentLocale_WithZerosStripped is eCurrentLocale, but with many cases of trailing zero's, and sometimes leading zeros, stripped, so for example, 01:03:05 PM will become 1:03:05 PM, and 04:06:00 PM will become 4:06 PM.
Definition at line 224 of file TimeOfDay.h.
|
constexprdefaultnoexcept |
If value out of range - pinned to kMax. We normalize to be within a given day (seconds since midnight)
For the TimeOfDay, we allow out of range values and pin/accumulate. But you can still never have a time of day >= kMaxSecondsPerDay. And the first hour (1pm) is hour 0, so TimeOfDay{2, 0, 0} is 3am.
if DataExchange::ValidationStrategy is NOT specified, or == DataExchange::ValidationStrategy::eAssertion, then
Always produces a valid legal TimeOfDay, or throws an exception.
The overload which takes a locale but no explicit format strings, defaults to trying each of kDefaultParseFormats strings in order, and returns the first match.
The overload taking an iterable of formats, tries each, and returns the timeofday for the first that succeeds, or throws FormatException if none succeed.
Definition at line 176 of file TimeOfDay.cpp.
|
constexpr |
Definition at line 25 of file TimeOfDay.inl.
|
constexpr |
returns 0..23
Definition at line 30 of file TimeOfDay.inl.
|
constexpr |
returns 0..59
Definition at line 36 of file TimeOfDay.inl.
|
constexpr |
returns 0..59
Definition at line 44 of file TimeOfDay.inl.
String TimeOfDay::Format | ( | NonStandardPrintFormat | pf = NonStandardPrintFormat::eDEFAULT | ) | const |
For formatPattern, see http://en.cppreference.com/w/cpp/locale/time_put/put If only formatPattern specified, and no locale, use default (global) locale.
Definition at line 303 of file TimeOfDay.cpp.
String Stroika::Foundation::Time::TimeOfDay::ToString | ( | ) | const |
Definition at line 52 of file TimeOfDay.inl.
|
staticconstexpr |
NB: The maximum value in a TimeOfDay struct is one less than kMaxSecondsPerDay
Definition at line 68 of file TimeOfDay.h.
|
staticconstexpr |
Definition at line 107 of file TimeOfDay.h.
|
staticconstexpr |
Definition at line 113 of file TimeOfDay.h.
|
staticconstexpr |
Definition at line 119 of file TimeOfDay.h.
|
static |
Default formats used by TimeOfDay::Parse () to parse time strings. The first of these - X, is the locale-specific time format.
Definition at line 128 of file TimeOfDay.h.
|
staticconstexpr |
kMin is the first date this TimeOfDay class supports representing.
Definition at line 174 of file TimeOfDay.h.
|
staticconstexpr |
kMax is the last date this TimeOfDay class supports representing. This is a legal TimeOfDay, and not like 'end' - one past the last legal value.
Definition at line 181 of file TimeOfDay.h.