libfilezilla
Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
duration Class Referencefinal

The duration class represents a time interval in milliseconds. More...

#include <time.hpp>

Public Member Functions

durationoperator+= (duration const &op)
 
durationoperator-= (duration const &op)
 
durationoperator/= (int64_t op)
 
duration operator- () const
 
 operator bool () const
 
durationoperator*= (int64_t op)
 
duration absolute () const
 
bool operator< (duration const &op) const
 
bool operator<= (duration const &op) const
 
bool operator> (duration const &op) const
 
bool operator>= (duration const &op) const
 
Getters

All getters return the total time of the duration, rounded down to the requested granularity.

int64_t get_days () const
 
int64_t get_hours () const
 
int64_t get_minutes () const
 
int64_t get_seconds () const
 
int64_t get_milliseconds () const
 

Static Public Member Functions

static duration from_days (int64_t m)
 
static duration from_hours (int64_t m)
 
static duration from_minutes (int64_t m)
 
static duration from_seconds (int64_t m)
 
static duration from_milliseconds (int64_t m)
 

Friends

duration operator- (duration const &a, duration const &b)
 
duration operator+ (duration const &a, duration const &b)
 
duration operator/ (duration const &a, int64_t b)
 

Related Functions

(Note that these are not member functions.)

duration operator- (datetime const &a, datetime const &b)
 Gets the difference between two timestamps as duration. More...
 
duration operator- (monotonic_clock const &a, monotonic_clock const &b)
 

Detailed Description

The duration class represents a time interval in milliseconds.

Constructing a non-empty duration is only possible using the static setters which have the time unit as part of the function name.

In contract to datetime, duration does not track accuracy.

Note
Arithmetic operations on duration do not check for integer over/underflow
Examples
timer_fizzbuzz.cpp.

Friends And Related Function Documentation

◆ operator-() [1/2]

duration operator- ( datetime const &  a,
datetime const &  b 
)
related

Gets the difference between two timestamps as duration.

This function ignores accuracy, it treats both timestamps as if they had millisecond-accuracy.

◆ operator-() [2/2]

duration operator- ( monotonic_clock const &  a,
monotonic_clock const &  b 
)
related

Gets the difference between two clocks as duration


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