CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 30 Jul 2025 03:51:55 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/locale/time_get/get_time/
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 30 Jul 2025 03:51:55 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"9966-/eDHVPMGqrwgO2+MACWb2qS1CIM"
Content-Encoding: gzip
Parses the sequence of characters between s and end for a time sequence, and stores its values into the tm object pointed by t.
The function reads characters until the character read cannot be part of a valid time sequence expression or end is reached. The next character after the last one processed by the function is pointed by the iterator returned by the function.
If successful, the function sets the relevant members of the tm structure t. The remaining members are left unchanged.
Member type iter_type is the facet's iterator type (defined as an alias of time_get's second template parameter, InputIterator).
Output:
Arguments str, err and t may be modified.
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
<locale>
- has_facet
- locale
- use_facet
-
wbuffer_convertC++11
-
wstring_convertC++11
functions
standard facets
time_get
- time_get::time_get
public member functions
protected members
public member function
<locale>
std::time_get::get_time
iter_type get_time (iter_type s, iter_type end, ios_base& str, ios_base::iostate& err, tm* t) const;
Read time
The function reads characters until the character read cannot be part of a valid time sequence expression or end is reached. The next character after the last one processed by the function is pointed by the iterator returned by the function.
If successful, the function sets the relevant members of the tm structure t. The remaining members are left unchanged.
Internally, this function simply calls the virtual protected member do_get_time, which by default parses characters following the same format produced by
The function updates err with the result of the operation if necessary:
- If the format of the sequence is not valid, the function sets failbit.
- Otherwise, it is unspecified, although some implementations set err to eofbit if the function exhausts the sequence of characters (i.e., it reaches end, both in case of success and failure), or to goodbit otherwise.
"%X"
in strftime.The function updates err with the result of the operation if necessary:
- If the format of the sequence is not valid, the function sets failbit.
- Otherwise, it is unspecified, although some implementations set err to eofbit if the function exhausts the sequence of characters (i.e., it reaches end, both in case of success and failure), or to goodbit otherwise.
Internally, this function simply calls the virtual protected member do_get_time, which by default parses characters following the same format produced by
The function updates err with the result of the operation if necessary:
- If the format of the sequence is not valid, the function sets failbit.
- If the function exhausts the sequence of characters (i.e., it reaches end) during its operations, it sets eofbit (both failbit and eofbit may be set by a single operation).
- Otherwise, it is unspecified, although some implementations set err to goodbit.
"%H:%M:%S"
in strftime.The function updates err with the result of the operation if necessary:
- If the format of the sequence is not valid, the function sets failbit.
- If the function exhausts the sequence of characters (i.e., it reaches end) during its operations, it sets eofbit (both failbit and eofbit may be set by a single operation).
- Otherwise, it is unspecified, although some implementations set err to goodbit.
Parameters
- s, end
- Iterators pointing to the beginning and end characters of the sequence. The range used is
[s,end)
, which contains all the characters between s and end, including the character pointed by s but not the character pointed by end.
Member type iter_type is the facet's iterator type (defined as an alias of time_get's second template parameter, InputIterator). By default, this is an istreambuf_iterator, allowing implicit conversions from basic_istream objects. - str
- Object of a class derived from ios_base (generally an input stream object). It is only used to obtain formatting information.
- err
- Stream error state object, of type ios_base::iostate where the error states are stored.
- t
- Pointer to an object of type struct tm (defined in header
<ctime>
), whose members are set by a successful call to this member function.
Return value
The next character in the sequence right after the last character used by the operation.Member type iter_type is the facet's iterator type (defined as an alias of time_get's second template parameter, InputIterator).
Example
|
|
Output:
hours: 7 min: 30 sec: 0 |
Data races
The object, and up to the entire range between s and end, are accessed.Arguments str, err and t may be modified.
Exception safety
If an exception is thrown, there are no changes in the facet object, although some of the arguments may have been affected.See also
- time_get::get_date
- Read date (public member function)
- time_put::put
- Write time and date (public member function)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us