[time.clock.gps.nonmembers]

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

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

### 30.7.5 Class gps_clock [[time.clock.gps]](time.clock.gps#nonmembers)

#### 30.7.5.3 Non-member functions [time.clock.gps.nonmembers]

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

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

[1](#1)

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

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

[2](#2)

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

[*Example [1](#example-1)*: auto st = sys_days{2000y/January/1};auto gt = clock_cast<gps_clock>(st);
cout << format("{0:%F %T %Z} == {1:%F %T %Z}\n", st, gt);

Produces this output:

```
2000-01-01 00:00:00 UTC == 2000-01-01 00:00:13 GPS

```

â *end example*]

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

[3](#3)

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

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

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

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

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

[4](#4)

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

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