atlas
Time.h
1 /*
2  * (C) Copyright 2020 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation
8  * nor does it submit to any jurisdiction.
9  */
10 
11 #pragma once
12 
13 #include <cstdint>
14 #include <iosfwd>
15 #include <string>
16 
17 namespace eckit {
18 class JSON;
19 }
20 namespace atlas {
21 namespace io {
22 
24 struct Time {
25  std::uint64_t tv_sec{0};
26  std::uint64_t tv_nsec{0};
27 
29  static Time now();
30 
32  void print( std::ostream& ) const;
33 
34  friend std::ostream& operator<<( std::ostream&, const Time& );
35  friend eckit::JSON& operator<<( eckit::JSON&, const Time& );
36 
38  std::string str() const;
39 };
40 
41 
42 } // namespace io
43 } // namespace atlas
Definition: Domain.h:19
Store UTC time up to nanosecond precision.
Definition: Time.h:24
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33