std::chrono::time_point
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <chrono>
|
||
template< class Clock, |
(dal C++11) | |
Modello
std::chrono::time_point
classe rappresenta un punto nel tempo. È implementato come se si memorizza un valore di tipo Duration
indica l'intervallo di tempo dall'inizio di epoca della Clock
di. 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.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica] Membri tipi
Membro 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 , l'orologio sul quale si misura tale punto temporaleOriginal: Clock , the clock on which this time point is measuredThe 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 utilizzato per misurare il tempo trascorso epocaOriginal: Duration , a std::chrono::duration type used to measure the time since epochThe 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 aritmetico che rappresenta il numero di segni di graduazione della durataOriginal: Rep , an arithmetic type representing the number of ticks of the durationThe 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 che rappresenta il periodo std::ratio tick della durataOriginal: Period , a std::ratio type representing the tick period of the durationThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Membri funzioni
costruisce un nuovo punto di tempo 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. (metodo pubblico) | |
restituisce il punto di tempo come durata dall'inizio del suo orologio 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. (metodo pubblico) | |
modifica il punto di tempo dalla data durata 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. (metodo pubblico) | |
[statico] |
restituisce il punto di tempo corrispondente alla durata minima 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. (metodo pubblico statico) |
[statico] |
returns the time point corresponding to the largest duration (metodo pubblico statico) |
[modifica] Non membri funzioni
specializzata il tratto 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 modello di specializzazione) | |
modifica il punto di tempo dalla data durata 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. (funzione di modello) | |
confronta due punti temporali 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. (funzione di modello) | |
converts a time point to another time point on the same clock, with a different duration (funzione di modello) |
[modifica] Esempio
Questo esempio visualizza l'ora attuale meno 24 ore:
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.
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
[modifica] Vedi anche
(C++11) |
un intervallo di tempo 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. (classe template) |