Espaces de noms
Variantes
Affichages
Actions

std::chrono::duration

De cppreference.com
< cpp‎ | chrono


 
 
 
 
std::chrono::duration
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
duration::duration
duration::operator=
duration::count
duration::zero
duration::min
duration::max
duration::operator+
duration::operator-
duration::operator++
duration::operator--
duration::operator+=
duration::operator-=
duration::operator*=
duration::operator/=
duration::operator%=
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
common_type
operator+
operator-
operator*
operator/
operator%
operator==
operator!=
operator<
operator<=
operator>
operator>=
duration_cast
Classes d'aide
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
treat_as_floating_point
duration_values
 
Defined in header <chrono>
template<

    class Rep,
    class Period = std::ratio<1>

> class duration;
(depuis C++11)
std::chrono::duration modèle de classe représente un intervalle de temps .
Original:
Class template std::chrono::duration represents a time interval.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Il se compose d'un nombre de ticks de Rep type et une période tique, où la période tique est une constante de compilation rationnelle représentant le nombre de secondes à partir d'une impulsion vers l'autre .
Original:
It consists of a count of ticks of type Rep and a tick period, where the tick period is a compile-time rational constant representing the number of seconds from one tick to the next.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Les seules données stockées dans un duration est un nombre de cycles de Rep type. Si Rep est en virgule flottante, puis la duration peuvent représenter des fractions de tiques. Period est inclus dans le cadre du type de la durée, et n'est utilisé que lors de la conversion entre les différentes durées .
Original:
The only data stored in a duration is a tick count of type Rep. If Rep is floating point, then the duration can represent fractions of ticks. Period is included as part of the duration's type, and is only used when converting between different durations.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sommaire

[modifier] Types de membres

Type du membre Définition
rep
Rep, un type de calcul qui représente le nombre de graduations
Original:
Rep, an arithmetic type representing the number of ticks
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
period
Period, un std::ratio représentant la période tique (ie le nombre de secondes par tick)
Original:
Period, a std::ratio representing the tick period (i.e. the number of seconds per tick)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Fonctions membres

construit une nouvelle durée
Original:
constructs new duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
affecte le contenu
Original:
assigns the contents
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
renvoie le nombre de tiques
Original:
returns the count of ticks
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
returns the special duration value zero
(fonction membre publique statique) [edit]
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
retourne la valeur min durée spéciale
Original:
returns the special duration value min
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique statique) [edit]
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
retourne la valeur max durée spéciale
Original:
returns the special duration value max
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique statique) [edit]
met en œuvre + unaire et unaire -
Original:
implements unary + and unary -
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
incrémente ou décrémente le nombre de cycles
Original:
increments or decrements the tick count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]
met en œuvre affectation composée entre deux durées
Original:
implements compound assignment between two durations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique) [edit]

[modifier] Non-membres genres

Type d'
Original:
Type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
std::chrono::nanoseconds
Type de durée avec std::nano période
Original:
duration type with Period std::nano
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::chrono::microseconds
Type de durée avec std::micro période
Original:
duration type with Period std::micro
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::chrono::milliseconds
Type de durée avec std::milli période
Original:
duration type with Period std::milli
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::chrono::seconds
Type de durée avec std::ratio<1> période
Original:
duration type with Period std::ratio<1>
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::chrono::minutes
Type de durée avec std::ratio<60> période
Original:
duration type with Period std::ratio<60>
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::chrono::hours
Type de durée avec std::ratio<3600> période
Original:
duration type with Period std::ratio<3600>
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Fonctions annexes

se spécialise trait std::common_type
Original:
specializes the std::common_type trait
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe générique spécialisée) [edit]
met en œuvre des opérations arithmétiques avec des durées comme arguments
Original:
implements arithmetic operations with durations as arguments
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]
compare deux durées
Original:
compares two durations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]
convertit une durée à l'autre, avec un intervalle tic différent
Original:
converts a duration to another, with a different tick interval
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction générique) [edit]

[modifier] Classes d'aide

indique que la durée est converti en durée à la période tique différente
Original:
indicates that a duration is convertible to duration with different tick period
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe générique)
constructions zéro, min, max et les valeurs d'un nombre de cycles de type donné
Original:
constructs zero, min, and max values of a tick count of given type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe générique)

[modifier] Exemple

Cet exemple montre comment définir plusieurs types de durée personnalisés et des conversions entre types:
Original:
This example shows how to define several custom duration types and convert between types:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <chrono>
 
int main()
{
    typedef std::chrono::duration<int, std::ratio<1, 100000000>> shakes;
    typedef std::chrono::duration<int, std::centi> jiffies;
    typedef std::chrono::duration<float, std::ratio<12096,10000>> microfortnights;
    typedef std::chrono::duration<float, std::ratio<3155,1000>> nanocenturies;
 
    std::chrono::seconds sec(1);
 
    std::cout << "1 second is:\n";
 
    std::cout << std::chrono::duration_cast<shakes>(sec).count()
              << " shakes\n";
    std::cout << std::chrono::duration_cast<jiffies>(sec).count()
              << " jiffies\n";
    std::cout << std::chrono::duration_cast<microfortnights>(sec).count()
              << " microfortnights\n";
    std::cout << std::chrono::duration_cast<nanocenturies>(sec).count()
              << " nanocenturies\n";
}

Résultat :

1 second is:
100000000 shakes
100 jiffies
0.82672 microfortnights
0.316957 nanocenturies