dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
TimePeriod Struct Reference

Value class for period of time with support for ISO8601 duration format. More...

#include <TimePeriod.hpp>

Public Member Functions

std::int64_t getTime () const
 Returns value in milliseconds.
 
std::int32_t getSeconds () const
 Returns value in seconds.
 
std::int64_t getNanos () const
 Returns value in nanoseconds.
 

Static Public Member Functions

static TimePeriod valueOf (std::int64_t value)
 Returns TimePeriod with value milliseconds.
 
static TimePeriod valueOf (std::chrono::milliseconds value)
 Returns TimePeriod with value milliseconds.
 
static TimePeriod valueOf (const StringLikeWrapper &value)
 Returns TimePeriod represented with a given string.
 

Static Public Attributes

static const TimePeriod ZERO
 Time-period of zero.
 
static const TimePeriod UNLIMITED
 Time-period of "infinity" (time of std::numeric_limits<std::int64_t>::max() or LLONG_MAX).
 

Detailed Description

Value class for period of time with support for ISO8601 duration format.

Member Function Documentation

◆ getNanos()

std::int64_t TimePeriod::getNanos ( ) const

Returns value in nanoseconds.

Returns
value in nanoseconds

◆ getSeconds()

std::int32_t TimePeriod::getSeconds ( ) const

Returns value in seconds.

Returns
value in seconds

◆ getTime()

std::int64_t TimePeriod::getTime ( ) const

Returns value in milliseconds.

Returns
value in milliseconds

◆ valueOf() [1/3]

TimePeriod TimePeriod::valueOf ( const StringLikeWrapper & value)
static

Returns TimePeriod represented with a given string.

Allowable format is ISO8601 duration, but there are some simplifications and modifications available:

  • Letters are case insensitive.
  • Letters "P" and "T" can be omitted.
  • Letter "S" can be also omitted. In this case last number will be supposed to be seconds.
  • Number of seconds can be fractional. So it is possible to define duration accurate within milliseconds.
  • Every part can be omitted. It is supposed that it's value is zero then.
  • String "inf" recognized as unlimited period.
Parameters
valueThe string representation
Returns
TimePeriod represented with a given string.

◆ valueOf() [2/3]

static TimePeriod TimePeriod::valueOf ( std::chrono::milliseconds value)
inlinestatic

Returns TimePeriod with value milliseconds.

Parameters
valuevalue in milliseconds
Returns
TimePeriod with value milliseconds.

◆ valueOf() [3/3]

TimePeriod TimePeriod::valueOf ( std::int64_t value)
static

Returns TimePeriod with value milliseconds.

Parameters
valuevalue in milliseconds
Returns
TimePeriod with value milliseconds.

Referenced by DXFeedSubscription::setAggregationPeriod().