FreeBSD Manual Pages
std::chrono::parse(3) C++ Standard Libary std::chrono::parse(3) NAME std::chrono::parse - std::chrono::parse Synopsis Defined in header <chrono> template< class CharT, class Parsable > (1) (since C++20) /* unspecified */ parse( const CharT* fmt, Parsable& tp ); template< class CharT, class Traits, class Alloc, class Parsable > /* unspecified */ parse( const std::basic_string<CharT, Traits, (2) (since C++20) Alloc>& fmt, Parsable& tp ); template< class CharT, class Traits, class Alloc, class Parsable > /* unspecified */ parse( const CharT* fmt, Parsable& tp, (3) (since C++20) std::basic_string<CharT, Traits, Alloc>& abbrev ); template< class CharT, class Traits, class Alloc, class Parsable > /* unspecified */ parse( const std::basic_string<CharT, Traits, Alloc>& fmt, (4) (since C++20) Parsable& tp, std::basic_string<CharT, Traits, Alloc>& abbrev ); template< class CharT, class Parsable > /* unspecified */ parse( const CharT* fmt, Parsable& tp, (5) (since C++20) std::chrono::minutes& offset ); template< class CharT, class Traits, class Alloc, class Parsable > /* unspecified */ parse( const std::basic_string<CharT, Traits, (6) (since C++20) Alloc>& fmt, Parsable& tp, std::chrono::minutes& offset ); template< class CharT, class Traits, class Alloc, class Parsable > /* unspecified */ parse( const CharT* fmt, Parsable& tp, (7) (since C++20) std::basic_string<CharT, Traits, Alloc>& abbrev, std::chrono::minutes& offset ); template< class CharT, class Traits, class Alloc, class Parsable > /* unspecified */ parse( const std::basic_string<CharT, Traits, Alloc>& fmt, (8) (since C++20) Parsable& tp, std::basic_string<CharT, Traits, Alloc>& abbrev, std::chrono::minutes& offset ); Returns an object manip of unspecified type such that, given a std::basic_istream<CharT, Traits> object is, the expression is >> manip calls from_stream (unqualified, to enable argument-dependent lookup) as follows: 1) from_stream(is, fmt, tp) 2) from_stream(is, fmt.c_str(), tp) 3) from_stream(is, fmt, tp, std::addressof(abbrev)) 4) from_stream(is, fmt.c_str(), tp, std::addressof(abbrev)) 5) from_stream(is, fmt, tp, static_cast<std::basic_string<CharT, Traits, Alloc>*>(nullptr), &offset) 6) from_stream(is, fmt.c_str(), tp, static_cast<std::basic_string<CharT, Traits, Alloc>*>(nullptr), &offset) 7) from_stream(is, fmt, tp, std::addressof(abbrev), &offset) 8) from_stream(is, fmt.c_str(), tp, std::addressof(abbrev), &off- set). The expression is >> manip is an lvalue of type std::ba- sic_istream<CharT, Traits> with the value is. These overloads participate in overload resolution only if the cor- responding from_stream expression is well-formed. Implementations are recommended to make it difficult to use poten- tially dangling references to the format string, e.g., by making return types non- movable and preventing operator>> from accepting lvalues of return types. Parameters fmt - a format string (see below) tp - object to hold the parse result abbrev - string to hold the time zone abbreviation or name corre- sponding to the %Z specifier offset - duration to represent the offset from UTC corresponding to the %z specifier Format string The format string consists of zero or more conversion specifiers and ordinary characters. Each ordinary character, excluding whitespace characters and the terminating null character, matches one identical character from the input stream, or causes the function to fail if the next character on the stream does not compare equal. Each whitespace character matches zero or more whitespace characters in the input stream. Each unmodified conversion specifier begins with a % character fol- lowed by a character that determines the behavior of the specifier. Some con- version specifiers have a modified form in which an E or O modifier character is in- serted after the % character. Some conversion specifiers have a modified form in which a width parameter given as a positive decimal integer (shown as N below) is inserted after the % character. Each conversion specifier causes the matched char- acters to be interpreted as parts of date and time types according to the table below. A character sequence in the format string that begins with a % but does not match one of the conversion specifiers below is interpreted as ordinary characters. If from_stream fails to parse everything specified by the format string, or if insufficient information is parsed to specify a complete result, or if parsing discloses contradictory information, is.set- state(std::ios_base::failbit) is called. The following conversion specifiers are available: Conversion Explanation specifier %% Matches a literal % character. %n Matches one whitespace character. %t Matches zero or one whitespace character. Year Parses the century as a decimal number. The width N spec- ifies the %C maximum number of characters to read. The default width is 2. Leading %NC zeroes are permitted but not required. %EC The modified command %EC interprets the locale's alterna- tive representation of the century. Parses the last two decimal digits of the year. If the century is not otherwise specified (e.g. with %C), values in the range [69, 99] are %y presumed to refer to the years 1969 to 1999, and values in the range %Ny [00, 68] are presumed to refer to the years 2000 to 2068. The width N %Ey specifies the maximum number of characters to read. The default width is %Oy 2. Leading zeroes are permitted but not required. The modified commands %Ey and %Oy interpret the locale's alternative representation. Parses the year as a decimal number. The width N speci- fies the maximum %Y number of characters to read. The default width is 4. Leading zeroes are %NY permitted but not required. %EY The modified command %EY interprets the locale's alterna- tive representation. Month %b %B Parses the locale's full or abbreviated case-insensitive month name. %h Parses the month as a decimal number (January is 1). The width N %m specifies the maximum number of characters to read. The default width is %Nm 2. Leading zeroes are permitted but not required. %Om The modified command %Om interprets the locale's alterna- tive representation. Day %d Parses the day of month as a decimal number. The width N specifies the %Nd maximum number of characters to read. The default width is 2. Leading %Od zeroes are permitted but not required. %e %Ne The modified commands %Od and %Oe interpret the locale's alternative %Oe representation. Day of the week %a Parses the locale's full or abbreviated case-insensitive weekday name. %A %u Parses the ISO weekday as a decimal number (1-7), where Monday is 1. The %Nu width N specifies the maximum number of characters to read. The default width is 1. Leading zeroes are permitted but not re- quired. Parses the weekday as a decimal number (0-6), where Sun- day is 0. The %w width N specifies the maximum number of characters to read. The default %Nw width is 1. Leading zeroes are permitted but not re- quired. %Ow The modified command %Ow interprets the locale's alterna- tive representation. ISO 8601 week-based year In ISO 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements: * Includes January 4 * Includes first Thursday of the year %g Parses the last two decimal digits of the ISO 8601 week- based year. The %Ng width N specifies the maximum number of characters to read. The default width is 2. Leading zeroes are permitted but not re- quired. %G Parses the ISO 8601 week-based year as a decimal number. The width N %NG specifies the maximum number of characters to read. The default width is 4. Leading zeroes are permitted but not required. %V Parses the ISO 8601 week of the year as a decimal number. The width N %NV specifies the maximum number of characters to read. The default width is 2. Leading zeroes are permitted but not required. Week/day of the year %j Parses the day of the year as a decimal number (January 1 is 1). The %Nj width N specifies the maximum number of characters to read. The default width is 3. Leading zeroes are permitted but not re- quired. Parses the week number of the year as a decimal number. The first Sunday of the year is the first day of week 01. Days of the same year prior to %U that are in week 00. The width N specifies the maximum number of %NU characters to read. The default width is 2. Leading ze- roes are permitted %OU but not required. The modified command %OU interprets the locale's alterna- tive representation. Parses the week number of the year as a decimal number. The first Monday of the year is the first day of week 01. Days of the same year prior to %W that are in week 00. The width N specifies the maximum number of %NW characters to read. The default width is 2. Leading ze- roes are permitted %OW but not required. The modified command %OW interprets the locale's alterna- tive representation. Date %D Equivalent to "%m/%d/%y". %F Equivalent to "%Y-%m-%d". If the width is specified, it is only applied %NF to the %Y. Parses the locale's date representation. %x %Ex The modified command %Ex interprets the locale's alter- nate date representation. Time of day Parses the hour (24-hour clock) as a decimal number. The width N %H specifies the maximum number of characters to read. The default width is %NH 2. Leading zeroes are permitted but not required. %OH The modified command %OH interprets the locale's alterna- tive representation. Parses the hour (12-hour clock) as a decimal number. The width N %I specifies the maximum number of characters to read. The default width is %NI 2. Leading zeroes are permitted but not required. %OI The modified command %OI interprets the locale's alterna- tive representation. Parses the minute as a decimal number. The width N speci- fies the maximum %M number of characters to read. The default width is 2. Leading zeroes are %NM permitted but not required. %OM The modified command %OM interprets the locale's alterna- tive representation. Parses the second as a decimal number. The width N speci- fies the maximum %S number of characters to read. The default width is 2. Leading zeroes are %NS permitted but not required. %OS The modified command %OS interprets the locale's alterna- tive representation. %p Parses the locale's equivalent of the AM/PM designations associated with a 12-hour clock. %R Equivalent to "%H:%M". %T Equivalent to "%H:%M:%S". %r Parses the locale's 12-hour clock time. Parses the locale's time representation. %X %EX The modified command %EX interprets the locale's alter- nate time representation. Miscellaneous Parses the locale's date and time representation. %c %Ec The modified command %Ec interprets the locale's alterna- tive date and time representation. Parses the offset from UTC in the format [+|-]hh[mm]. For example -0430 refers to 4 hours 30 minutes behind UTC and 04 refers to 4 hours ahead %z of UTC. %Ez %Oz The modified commands %Ez and %Oz parses the format [+|-]h[h][:mm] (i.e., requiring a : between the hours and minutes and making the leading zero for hour optional). Parses the time zone abbreviation or name, taken as the longest sequence %Z of characters that only contains the characters A through Z, a through z, 0 through 9, -, +, _, and /. Example This section is incomplete Reason: no example Defect reports The following behavior-changing defect reports were applied retroac- tively to previously published C++ standards. DR Applied to Behavior as published Correct behavior LWG 3554 C++20 overloads for plain null-terminated character added type sequences were missing See also from_stream(std::chrono::sys_time) parses a sys_time from a stream according to (C++20) the provided format (function template) from_stream(std::chrono::utc_time) parses a utc_time from a stream according to (C++20) the provided format (function template) from_stream(std::chrono::tai_time) parses a tai_time from a stream according to (C++20) the provided format (function template) from_stream(std::chrono::gps_time) parses a gps_time from a stream according to (C++20) the provided format (function template) from_stream(std::chrono::file_time) parses a file_time from a stream according to (C++20) the provided format (function template) from_stream(std::chrono::local_time) parses a local_time from a stream according to (C++20) the provided format (function template) from_stream parses a year from a stream ac- cording to the (C++20) provided format (function template) from_stream parses a month from a stream according to the (C++20) provided format (function template) from_stream parses a day from a stream ac- cording to the (C++20) provided format (function template) from_stream parses a weekday from a stream according to the (C++20) provided format (function template) from_stream parses a month_day from a stream according to (C++20) the provided format (function template) from_stream parses a year_month from a stream according to (C++20) the provided format (function template) from_stream parses a year_month_day from a stream according (C++20) to the provided format (function template) get_time parses a date/time value of specified format (C++11) (function template) http://cppreference.com 2022.07.31 std::chrono::parse(3)
NAME | Synopsis | Parameters | Miscellaneous | Example | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::chrono::parse&sektion=3&manpath=FreeBSD+Ports+15.0>
