std::mktime
Aus cppreference.com
|
|
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. |
<metanoindex/>
<tbody> </tbody>| definiert in Header <ctime>
|
||
std::time_t mktime( std::tm* time ); |
||
Konvertiert lokalen Kalender auf eine Zeit, da Epoche als std::time_t Objekt, ignoriert die Werte
time->tm_wday und time->yday. Die Werte der anderen Komponenten time nicht auf ihre üblichen Bereiche beschränkt. Ein negativer Wert von time->tm_isdst verursacht mktime zu versuchen, festzustellen, ob Daylight Saving Time in Kraft war .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.
Wenn dies gelingt, berechnet und aktualisiert alle Felder in
time an ihren richtigen Bereiche zu passen .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.
Parameter
| time | - | Zeiger auf ein Objekt std::tm Angabe lokalen Kalender Zeit zu konvertieren
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. |
Rückgabewert
Zeit seit Epoche als std::time_t Objekt auf Erfolg oder
-1 wenn time nicht als std::time_t Objekt dargestellt werden .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.
Beispiel
Zeigt die Zeit 100 Monaten
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
Siehe auch
wandelt Mal seit Epoche Kalender Zeit ausgedrückt als lokale Zeit 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. (Funktion) | |
C documentation for mktime
| |