period

Overview

Type safe representation of period: the reciprocal of frequency, or the time it takes for a periodic event to complete one full cycle or oscillation.

Include

#include <q/support/period.hpp>

Declaration

period is a subclass of {duration} and inherits all its public member functions, member variables, and types.

struct period : duration
{
   using duration::duration;

   constexpr   period(duration d);
   constexpr   period(frequency f);
};

Expressions

As a subclass of duration, period inherits all the publicly accessible member functions, member variables, and types of its base class.

period is a model of Unit. In addition to valid expressions for Unit, period allows these expressions.

Notation

d

Object of type duration

f

Object of type frequency

p

Object of type period

Constructor

Expression Semantics

phase(d)

Construct a period given a duration, d

phase(f)

Construct a period given a frequency, f

C++ brace initialization may also be used.

Conversions

Expression Semantics Return Type

as_float(f)

Convert frequency to a float in seconds.

float

as_double(f)

Convert frequency to a double in seconds.

double