Espacios de nombres
Variantes
Acciones

std::chrono::time_point

De cppreference.com
< cpp‎ | chrono

 
 
Utilidades de la biblioteca
Escriba apoyo (basic types, RTTI, type traits)
Gestión de memoria dinámica
Gestión de errores
Programa de servicios públicos
Funciones variadic
Fecha y hora
Objetos Function
initializer_list(C++11)
bitset
hash(C++11)
Operadores relacionales
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares y tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Cambiar, hacia adelante y mover
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
 
std::chrono::time_point
Las funciones miembro
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.
time_point::time_point
time_point::time_since_epoch
time_point::operator+
time_point::operator-
time_point::min
time_point::max
Terceros funciones
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>=
time_point_cast
 
Defined in header <chrono>
template<

    class Clock,
    class Duration = typename Clock::duration

> class time_point;
(desde C++11)
std::chrono::time_point clase de plantilla representa un punto en el tiempo. Se lleva a cabo como si se almacena un valor de tipo Duration indica el intervalo de tiempo desde el inicio de la época de Clock .
Original:
Class template std::chrono::time_point represents a point in time. It is implemented as if it stores a value of type Duration indicating the time interval from the start of the Clock's epoch.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Tipos de miembros

Miembro de tipo
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
clock
Clock, el reloj de referencia para medir este punto de tiempo
Original:
Clock, the clock on which this time point is measured
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
duration
Duration, un tipo std::chrono::duration utilizado para medir el tiempo transcurrido desde la época
Original:
Duration, a std::chrono::duration type used to measure the time since epoch
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rep
Rep, un tipo de aritmética que representa el número de garrapatas de la duración
Original:
Rep, an arithmetic type representing the number of ticks of the duration
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 tipo std::ratio que representa el período de la duración garrapata
Original:
Period, a std::ratio type representing the tick period of the duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Las funciones miembro

construye un punto nuevo tiempo
Original:
constructs a new time point
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función) [edit]
devuelve el punto de tiempo como duración desde el inicio de su reloj
Original:
returns the time point as duration since the start of its clock
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función) [edit]
modifica el punto de tiempo por la duración dada
Original:
modifies the time point by the given duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro público función) [edit]
[estático]
devuelve el punto de tiempo correspondiente a la menor duración
Original:
returns the time point corresponding to the smallest duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(miembro estático público función) [edit]
[estático]
returns the time point corresponding to the largest duration
(miembro estático público función) [edit]

[editar] Terceros funciones

se especializa el rasgo 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.

(clase de especialización de plantilla) [edit]
modifica el punto de tiempo por la duración dada
Original:
modifies the time point by the given duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla) [edit]
compara dos puntos de tiempo
Original:
compares two time points
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla) [edit]
converts a time point to another time point on the same clock, with a different duration
(función de plantilla) [edit]

[editar] Ejemplo

En este ejemplo se muestra la hora actual menos las 24 horas:
Original:
This example prints the current time minus 24 hours:
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 <iomanip>
#include <ctime>
#include <chrono>
 
int main()
{
    std::chrono::time_point<std::chrono::system_clock> now;
    now = std::chrono::system_clock::now();
    std::time_t now_c = std::chrono::system_clock::to_time_t(
                            now - std::chrono::hours(24));
    std::cout << "One day ago, the time was "
              << std::put_time(std::localtime(&now_c), "%F %T") << '\n';
}

Possible output:

One day ago, the time was 2011-10-25 12:00:08

[editar] Ver también

(C++11)
un intervalo de tiempo
Original:
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.

(clase de plantilla)