netxsimdg
Loading...
Searching...
No Matches
Time.cpp File Reference
#include "include/Time.hpp"
#include <regex>
#include <sstream>
#include <stdexcept>
Include dependency graph for Time.cpp:

Go to the source code of this file.

Functions

std::tm & Nextsim::tmDoy (std::tm &tm)
 
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.
 
bool Nextsim::isDOYFormat (const std::string &iso)
 
std::vector< std::string > Nextsim::splitString (const std::string &str, char delim)
 
std::string Nextsim::addTimeLeadingZeros (const std::string &in)
 
std::tm Nextsim::getTimTime (const std::string &in, bool isDOY)
 
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.
 
Duration Nextsim::durationFromISO (const std::string &iso, int sign=+1)
 
Duration Nextsim::durationFromISO (std::istream &is, int sign=+1)
 

Detailed Description

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

Definition in file Time.cpp.

Function Documentation

◆ addTimeLeadingZeros()

std::string Nextsim::addTimeLeadingZeros ( const std::string & in)

Definition at line 98 of file Time.cpp.

◆ durationFromISO() [1/2]

Duration Nextsim::durationFromISO ( const std::string & iso,
int sign = +1 )

Definition at line 158 of file Time.cpp.

◆ durationFromISO() [2/2]

Duration Nextsim::durationFromISO ( std::istream & is,
int sign = +1 )

Definition at line 178 of file Time.cpp.

◆ getTimTime()

std::tm Nextsim::getTimTime ( const std::string & in,
bool isDOY )

Definition at line 117 of file Time.cpp.

◆ isDOYFormat()

bool Nextsim::isDOYFormat ( const std::string & iso)

Definition at line 69 of file Time.cpp.

◆ 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:

◆ splitString()

std::vector< std::string > Nextsim::splitString ( const std::string & str,
char delim )

Definition at line 87 of file Time.cpp.

◆ 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:

◆ tmDoy()

std::tm & Nextsim::tmDoy ( std::tm & tm)

Definition at line 30 of file Time.cpp.