netxsimdg
Loading...
Searching...
No Matches
Time.hpp File Reference
#include <array>
#include <chrono>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <sstream>
Include dependency graph for Time.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Nextsim::TimeOptions
 
class  Nextsim::Duration
 
class  Nextsim::TimePoint
 
struct  Nextsim::TimestepTime
 
class  Nextsim::StartStepStop
 

Typedefs

typedef std::chrono::system_clock Nextsim::SystemClock
 
typedef SystemClock::duration Nextsim::SystemDuration
 

Functions

std::time_t Nextsim::mkgmtime (std::tm *time, bool recalculateDoy=true)
 converts the std::tm struct to a std::time_t value assuming UTC.
 
int Nextsim::julianGregorianShiftDays (int year)
 Returns the number of days between the Julian and Gregorian years.
 
std::time_t Nextsim::timeFromISO (const std::string &iso)
 Returns a std::time_t from a given ISO date string of a specific format.
 
std::time_t Nextsim::timeFromISO (std::istream &is)
 Returns a std::time_t from a given ISO date string of a specific format.
 
double Nextsim::operator* (double a, const Duration &b)
 
double Nextsim::operator/ (double a, const Duration &b)
 
double Nextsim::operator* (const Duration &a, double b)
 
double Nextsim::operator/ (const Duration &a, double b)
 
std::istream & Nextsim::operator>> (std::istream &is, TimePoint &tp)
 
std::istream & Nextsim::operator>> (std::istream &is, Duration &dur)
 
std::ostream & Nextsim::operator<< (std::ostream &os, const TimePoint &tp)
 
std::ostream & Nextsim::operator<< (std::ostream &os, const Duration &dur)
 

Detailed Description

Date
Mar 15, 2022
Author
Tim Spain timot.nosp@m.hy.s.nosp@m.pain@.nosp@m.ners.nosp@m.c.no

Definition in file Time.hpp.

Typedef Documentation

◆ SystemClock

typedef std::chrono::system_clock Nextsim::SystemClock

Definition at line 30 of file Time.hpp.

◆ SystemDuration

typedef SystemClock::duration Nextsim::SystemDuration

Definition at line 31 of file Time.hpp.

Function Documentation

◆ julianGregorianShiftDays()

int Nextsim::julianGregorianShiftDays ( int year)

Returns the number of days between the Julian and Gregorian years.

Returns the number of days between 1st January of the given year in the Julian and Gregorian calendars.

Definition at line 60 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkgmtime()

std::time_t Nextsim::mkgmtime ( std::tm * time,
bool recalculateDoy = true )

converts the std::tm struct to a std::time_t value assuming UTC.

A UTC-fixed version of the standard library function mktime(). Calculates the duration between the Unix epoch and the given std::tm time and directly assigns that value.

Parameters
timePointer to the tm structure to interpret.
recalculateDoyFlag argument for whether to calculate the day of the year from the year month and day values.

Definition at line 39 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*() [1/2]

double Nextsim::operator* ( const Duration & a,
double b )
inline

Definition at line 254 of file Time.hpp.

◆ operator*() [2/2]

double Nextsim::operator* ( double a,
const Duration & b )
inline

Definition at line 252 of file Time.hpp.

◆ operator/() [1/2]

double Nextsim::operator/ ( const Duration & a,
double b )
inline

Definition at line 255 of file Time.hpp.

◆ operator/() [2/2]

double Nextsim::operator/ ( double a,
const Duration & b )
inline

Definition at line 253 of file Time.hpp.

◆ operator<<() [1/2]

std::ostream & Nextsim::operator<< ( std::ostream & os,
const Duration & dur )
inline

Definition at line 260 of file Time.hpp.

◆ operator<<() [2/2]

std::ostream & Nextsim::operator<< ( std::ostream & os,
const TimePoint & tp )
inline

Definition at line 259 of file Time.hpp.

◆ operator>>() [1/2]

std::istream & Nextsim::operator>> ( std::istream & is,
Duration & dur )
inline

Definition at line 258 of file Time.hpp.

◆ operator>>() [2/2]

std::istream & Nextsim::operator>> ( std::istream & is,
TimePoint & tp )
inline

Definition at line 257 of file Time.hpp.

◆ timeFromISO() [1/2]

std::time_t Nextsim::timeFromISO ( const std::string & iso)

Returns a std::time_t from a given ISO date string of a specific format.

Parameters
isoA std::string in the ISO YYYY-MM-DDThh:mm:ss format.

Definition at line 144 of file Time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeFromISO() [2/2]

std::time_t Nextsim::timeFromISO ( std::istream & is)

Returns a std::time_t from a given ISO date string of a specific format.

Parameters
isoA std::istream containing an ISO YYYY-MM-DDThh:mm:ss format date.

Definition at line 151 of file Time.cpp.

Here is the call graph for this function: