std::mktime
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 <ctime>
|
||
std::time_t mktime( std::tm* time ); |
||
Converte l'ora locale del calendario a un tempo da un'epoca come oggetto std::time_t, ignorando i valori di
time->tm_wday
e time->yday
. I valori delle altre componenti time
non sono limitati al loro gamme abituali. Un valore negativo di time->tm_isdst
provoca mktime
tentare di determinare se l'ora legale era in vigore.Original:
Converts local calendar time to a time since epoch as a std::time_t object, ignoring the values of
time->tm_wday
and time->yday
. The values of other components of time
are not restricted to their usual ranges. A negative value of time->tm_isdst
causes mktime
to attempt to determine if Daylight Saving Time was in effect.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.
In caso di successo, ricalcola e aggiorna tutti i campi in
time
per soddisfare le loro gamme corretta.Original:
If successful, recalculates and updates all fields in
time
to fit their proper ranges.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] Parametri
time | - | puntatore a un oggetto che specifica std::tm ora locale calendario da convertire
Original: pointer to a std::tm object specifying local calendar time to convert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Valore di ritorno
Tempo da epoca come un oggetto std::time_t in caso di successo o se -1
time
non può essere rappresentato come un oggetto std::time_t.Original:
Time since epoch as a std::time_t object on success or -1 if
time
cannot be represented as a std::time_t object.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.
[modifica] Esempio
Visualizzare l'ora 100 mesi fa
Original:
Display the time 100 months ago
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> int main() { std::time_t t = std::time(NULL); std::tm tm = *std::localtime(&t); std::cout << "Today is " << std::put_time(&tm, "%c %Z") <<'\n'; tm.tm_mon -= 100; std::mktime(&tm); std::cout << "100 months ago was " << std::put_time(&tm, "%c %Z") << '\n'; }
Output:
Today is Wed Dec 28 09:56:10 2011 EST 100 months ago was Thu Aug 28 10:56:10 2003 EDT
[modifica] Vedi anche
converte il tempo in quanto epoca di tempo del calendario espresso in ora locale Original: converts time since epoch to calendar time expressed as local time The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) | |
C documentation for mktime
|