std::chrono::system_clock::now
Da cppreference.com
< cpp | chrono | system clock
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
staticstd::chrono::time_point<std::chrono::system_clock> now(); | (desde C++11) | |
Retorna um ponto de tempo, representando, com o ponto atual no tempo.
Original:
Returns a time point representing with the current point in time.
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.
Índice |
[editar]Parâmetros
(Nenhum)
Original:
(none)
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.
[editar]Valor de retorno
Um ponto de tempo representa o tempo atual.
Original:
A time point representing the current time.
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.
[editar]Exceções
[editar]Exemplo
#include <iostream>#include <vector>#include <chrono> int main(){for(unsignedlonglong size =1; size <10000000; size *=10){auto start = std::chrono::system_clock::now();std::vector<int> v(size, 42);auto end = std::chrono::system_clock::now(); auto elapsed = end - start;std::cout<< size <<": "<< elapsed.count()<<'\n';}}
Potencial saída:
1: 1 10: 2 100: 3 1000: 6 10000: 47 100000: 507 1000000: 4822