# MI - Fimex: MetNoFimex::TimeUnit Class Reference

# MetNoFimex::TimeUnit Class Reference

`#include <TimeUnit.h>`

List of all members.

## Public Member Functions

| TimeUnit () throw (CDMException)
| initialize a timeUnit with a unit string
| TimeUnit (const std::string &timeUnitString) throw (CDMException)
virtual | ~TimeUnit ()
double | unitTime2epochSeconds (double unitTime) const
| calculate the epochSeconds for a time in the current unit
boost::posix_time::ptime | unitTime2posixTime (double unitTime) const
| calculate the ptime for a time in the current unit
double | epochSeconds2unitTime (double epochSeconds) const
| calculate the time in the current unit from the epoch
FimexTime | unitTime2fimexTime (double unitTime) const throw (CDMException)
| calculate the time in a calendar form
double | fimexTime2unitTime (const FimexTime &fiTime) const throw (CDMException)
| calculate the time in the current unit from the calendar form
double | fimexTime2unitTimeX (FimexTime fiTime) const throw (CDMException)
| same as fimexTime2unitTime but copying fiTime instead of referencing, needed for i.e. bind1st(mem_fun())
double | posixTime2unitTime (boost::posix_time::ptime poTime) const throw (CDMException)
| calculate the unitTime from a boost::posix_time

## Detailed Description

TimeUnit calculates times from a time given in a unit as of CF-1.0 (e.g. 'days since 2000-01-01 00:00:00') to a unix time (i.e. 'seconds since 1970-01-01 00:00:00') or a time struct MetNoFimex::FimexTime

All times are assumed to be UTC, and we use the Gregorian Calendar (not 100% true for times before 1600AD, depending on implementation)

## Constructor & Destructor Documentation

MetNoFimex::TimeUnit::TimeUnit | ( |  | ) | throw (CDMException)

initialize a timeUnit with a unit string

MetNoFimex::TimeUnit::TimeUnit | ( | const std::string & | timeUnitString | ) | throw (CDMException)

virtual MetNoFimex::TimeUnit::~TimeUnit | ( |  | ) | `[virtual]`

## Member Function Documentation

double MetNoFimex::TimeUnit::unitTime2epochSeconds | ( | double | unitTime | ) | const

calculate the epochSeconds for a time in the current unit

boost::posix_time::ptime MetNoFimex::TimeUnit::unitTime2posixTime | ( | double | unitTime | ) | const

calculate the ptime for a time in the current unit

double MetNoFimex::TimeUnit::epochSeconds2unitTime | ( | double | epochSeconds | ) | const

calculate the time in the current unit from the epoch

FimexTime MetNoFimex::TimeUnit::unitTime2fimexTime | ( | double | unitTime | ) | const throw (CDMException)

calculate the time in a calendar form

double MetNoFimex::TimeUnit::fimexTime2unitTime | ( | const FimexTime & | fiTime | ) | const throw (CDMException)

calculate the time in the current unit from the calendar form

Referenced by fimexTime2unitTimeX().

double MetNoFimex::TimeUnit::fimexTime2unitTimeX | ( | FimexTime | fiTime | ) | const throw (CDMException)`[inline]`

same as fimexTime2unitTime but copying fiTime instead of referencing, needed for i.e. bind1st(mem_fun())

References fimexTime2unitTime().

double MetNoFimex::TimeUnit::posixTime2unitTime | ( | boost::posix_time::ptime | poTime | ) | const throw (CDMException)

calculate the unitTime from a boost::posix_time

The documentation for this class was generated from the following file:

- include/fimex/TimeUnit.h