[time.clock.system.nonmembers]

# 30 Time library [[time]](./#time)

## 30.7 Clocks [[time.clock]](time.clock#system.nonmembers)

### 30.7.2 Class system_clock [[time.clock.system]](time.clock.system#nonmembers)

#### 30.7.2.3 Non-member functions [time.clock.system.nonmembers]

[ð](#lib:operator%3c%3c,sys_time)

`template<class charT, class traits, class Duration>
  basic_ostream<charT, traits>&
    operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2736)

*Constraints*: treat_as_floating_point_v<typename Duration​::​rep> is false, andDuration{1} < days{1} is true[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2741)

*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T}"), tp);

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2748)

[*Example [1](#example-1)*: cout << sys_seconds{0s} << '\n'; // 1970-01-01 00:00:00 cout << sys_seconds{946'684'800s} << '\n'; // 2000-01-01 00:00:00 cout << sys_seconds{946'688'523s} << '\n'; // 2000-01-01 01:02:03 â *end example*]

[ð](#lib:operator%3c%3c,sys_days)

`template<class charT, class traits>
  basic_ostream<charT, traits>&
    operator<<(basic_ostream<charT, traits>& os, const sys_days& dp);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2766)

*Effects*: os << year_month_day{dp}[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2770)

*Returns*: os[.](#5.sentence-1)

[ð](#lib:from_stream,sys_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,
                sys_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr,
                minutes* offset = nullptr);
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2785)

*Effects*: Attempts to parse the input stream is into the sys_time tp using
the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#6.sentence-1)

If the parse fails to decode a valid date,is.setstate(ios_base​::​failbit) is called andtp is not modified[.](#6.sentence-2)

If %Z is used and successfully parsed,
that value will be assigned to *abbrev if abbrev is non-null[.](#6.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[.](#6.sentence-4)

Additionally, the parsed offset will be subtracted
from the successfully parsed timestamp
prior to assigning that difference to tp[.](#6.sentence-5)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L2802)

*Returns*: is[.](#7.sentence-1)
