Go to the documentation of this file.
37 using TimeStep = std::chrono::duration<Numeric>;
42 std::chrono::system_clock::time_point
mtime;
52 explicit Time(std::time_t t) :
mtime(
std::chrono::system_clock::from_time_t(t)) {}
56 const std::chrono::system_clock::time_point&
Data()
const {
return mtime;}
59 std::time_t
toTimeT()
const {
return std::chrono::system_clock::to_time_t(
mtime);}
69 template <
typename T,
typename R>
Time&
operator+=(
const std::chrono::duration<T, R>& dt) {
mtime += std::chrono::duration_cast<InternalTimeStep>(dt);
return *
this;}
70 template <
typename T,
typename R>
Time&
operator-=(
const std::chrono::duration<T, R>& dt) {
mtime -= std::chrono::duration_cast<InternalTimeStep>(dt);
return *
this;}
71 template <
typename T,
typename R>
Time operator+(
const std::chrono::duration<T, R>& dt)
const {
return (
Time(*
this) += dt);}
72 template <
typename T,
typename R>
Time operator-(
const std::chrono::duration<T, R>& dt)
const {
return (
Time(*
this) -= dt);}
75 Numeric Seconds()
const {
return std::chrono::duration_cast<TimeStep>(
mtime.time_since_epoch()).count();}
93 inline std::ostream&
operator<<(std::ostream& os,
const TimeStep& dt) {
return os << dt.count() <<
" seconds";}
Time operator-(const std::chrono::duration< T, R > &dt) const
Time operator+(const std::chrono::duration< T, R > &dt) const
std::time_t toTimeT() const
ArrayOfIndex time_steps(const ArrayOfTime ×, const String &step)
Finds the index matching demands in a list of times.
Index Version() const noexcept
Numeric PartOfSecond() const
Time & operator+=(const std::chrono::duration< T, R > &dt)
void std(VectorView std, const Vector &y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the standard deviation of the ranged ys.
Vector y(Workspace &ws) noexcept
std::ostream & operator<<(std::ostream &os, const Time &t)
Output for Time.
std::chrono::duration< Numeric > TimeStep
A duration of time, 1 full tick should be 1 second.
This file contains the definition of Array.
This can be used to make arrays out of anything.
InternalTimeStep EpochTime() const
bool operator<(const Time &t) const
Time mean_time(const ArrayOfTime &ts, Index s=0, Index e=-1)
Computes the average time in a list.
NUMERIC Numeric
The type to use for all floating point numbers.
decltype(mtime)::duration InternalTimeStep
std::tm toGMTStruct() const
Time & operator-=(const std::chrono::duration< T, R > &dt)
TimeStep seconds_into_day() const
std::chrono::system_clock::time_point mtime
InternalTimeStep operator-(const Time &t) const
bool operator==(const Time &t) const
const std::chrono::system_clock::time_point & Data() const
Class to handle time in ARTS.
std::istream & operator>>(std::istream &is, Time &t)
Input for Time.
Time next_even(const Time &t, const TimeStep &dt)
Returns the next time after t with an even time-step.
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
This file contains the definition of String, the ARTS string class.