Files
2025-10-25 03:02:53 +03:00

73 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[time.clock.local]
# 30 Time library [[time]](./#time)
## 30.7 Clocks [[time.clock]](time.clock#local)
### 30.7.9 Local time [time.clock.local]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3511)
The family of time points
denoted by local_time<Duration> are based on the pseudo clock local_t[.](#1.sentence-1)
local_t has no member now() and thus does not meet the clock requirements[.](#1.sentence-2)
Nevertheless local_time<Duration> serves the vital role of
representing local time with respect to a not-yet-specified time zone[.](#1.sentence-3)
Aside from being able to get the current time,
the complete time_point algebra is available
for local_time<Duration> (just as for sys_time<Duration>)[.](#1.sentence-4)
[🔗](#lib:operator%3c%3c,local_time)
`template<class charT, class traits, class Duration>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const local_time<Duration>& lt);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3531)
*Effects*: os << sys_time<Duration>{lt.time_since_epoch()};
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3537)
*Returns*: os[.](#3.sentence-1)
[🔗](#lib:from_stream,local_time)
`template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
basic_istream<charT, traits>&
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
local_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
minutes* offset = nullptr);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3552)
*Effects*: Attempts to parse the input stream is into the local_time tp using
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13Parsing")[.](#4.sentence-1)
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified[.](#4.sentence-2)
If %Z is used and successfully parsed,
that value will be assigned to *abbrev if abbrev is non-null[.](#4.sentence-3)
If %z (or a modified variant) is used and successfully parsed,
that value will be assigned to *offset if offset is non-null[.](#4.sentence-4)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3566)
*Returns*: is[.](#5.sentence-1)