std::ctime
Материал из 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. |
| Заголовочный файл <ctime>
|
||
| char* ctime( const std::time_t* time ); |
||
Преобразует заданное время с начала эпохи в календаре по местному времени, а затем в текстовом представлении, как при вызове std::asctime(std::localtime(time)). В результате строка имеет следующий формат:
Original:
Converts given time since epoch to a calendar local time and then to a textual representation, as if by calling std::asctime(std::localtime(time)). The resulting string has the following format:
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.
Www Mmm dd hh:mm:ss yyyy
Www- день недели (один изMon,Tue,Wed,Thu,Fri,Sat,Sun).Original:Www- the day of the week (one ofMon,Tue,Wed,Thu,Fri,Sat,Sun).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.Mmm- месяц (один изJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec).Original:Mmm- the month (one ofJan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.dd- день месяцаOriginal:dd- the day of the monthThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.hh- часыOriginal:hh- hoursThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.mm- минутыOriginal:mm- minutesThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.ss- секундыOriginal:ss- secondsThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.yyyy- летOriginal:yyyy- yearsThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Функция не поддерживает локализацию.
Original:
The function does not support localization.
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.
Содержание |
[править] Параметры
| time | - | Указатель на std::time_t объекта с указанием времени для печати
Original: pointer to a std::time_t object specifying the time to print The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[править] Возвращаемое значение
Указатель на статическую нулем строку символов проведения текстовое представление даты и времени. Эта строка может быть разделена между
std::asctime и std::ctime, и могут быть перезаписаны при каждом вызове любой из этих функций.Original:
Pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between
std::asctime and std::ctime, and may be overwritten on each invocation of any of those functions.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.
[править] Notes
Эта функция возвращает указатель на статические данные и не является поточно-ориентированными. Кроме того, он изменяет статический объект std::tm, которые могут использоваться совместно с std::gmtime и std::localtime. POSIX отмечает эту функцию устаревшей, и рекомендует std::strftime вместо.
Original:
This function returns a pointer to static data and is not thread-safe. In addition, it modifies the static std::tm object which may be shared with std::gmtime and std::localtime. POSIX marks this function obsolete and recommends std::strftime instead.
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.
Поведение может быть определено для значений time_t, в результате строка длиннее 25 символов (например, год 10000)
Original:
The behavior may be undefined for the values of time_t that result in the string longer than 25 characters (e.g. year 10000)
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 <ctime> #include <iostream> int main() { std::time_t result = std::time(NULL); std::cout << std::ctime(&result); }
Вывод:
Tue Dec 27 17:21:29 2011
[править] См. также
| преобразует tm объекта в текстовое представлениеOriginal: converts a tm object to a textual representationThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
| преобразует tm объект пользовательского текстовое представлениеOriginal: converts a tm object to custom textual representationThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
| (C++11) |
Форматы и выходы значение даты / времени в соответствии с указанным форматом Original: formats and outputs a date/time value according to the specified format The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (шаблон функции) |
| C документация для ctime
| |