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
(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.
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.
(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.
(C++11)
(C++11)
(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.
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.
 
Definido en la cabecera <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.

(función miembro público) [editar]
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.

(función miembro público) [editar]
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 miembro público) [editar]
[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.

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

[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.

(especialización de plantilla de clase) [editar]
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.

(plantilla de función) [editar]
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.

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

[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';
}

Posible salida:

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.

(plantilla de clase)