ctime

来自cppreference.com
< c | chrono

 
 
日期和时间工具
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
时间操作
Original:
Time manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
difftime
time
clock
格式转换
Original:
Format conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
asctime
ctime
strftime
wcsftime
gmtime
localtime
mktime
常量
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CLOCKS_PER_SEC
类型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm
time_t
clock_t
 
Defined in header <time.h>
char* ctime( const time_t* time );
将已给定的时间,因为时代的日历本地时间,然后到一个文本表示,如果通过调用asctime(localtime(time))。得到的字符串具有以下格式:
Original:
Converts given time since epoch to a calendar local time and then to a textual representation, as if by calling asctime(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.
Www Mmm dd hh:mm:ss yyyy
  • Www - 星期几(之一MonTueWedThuFriSatSun).
    Original:
    Www - the day of the week (one of Mon, 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 - 月(之一JanFebMarAprMayJunJulAugSepOctNovDec).
    Original:
    Mmm - the month (one of Jan, 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 month
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • hh - 小时
    Original:
    hh - hours
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • mm - 分钟
    Original:
    mm - minutes
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • ss - 秒
    Original:
    ss - seconds
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • yyyy - 年
    Original:
    yyyy - years
    The 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.

目录

[编辑] 参数

time -
指定的时间打印到time_t对象的指针
Original:
pointer to a 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.

[编辑] 返回值

指针指向一个静态的空字符结尾的字符串的文字表示的日期和时间。 asctimectime之间的字符串可以共享,并在每次调用时可能会被覆盖的任何职能.
Original:
pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between asctime and 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.

[编辑] 注释

这个函数返回一个指向静态数据的指针,是不是线程安全的。此外,它可共享与tmgmtime修改静态localtime对象。 POSIX标志着这个功能已经过时,并建议strftime,而不是.
Original:
This function returns a pointer to static data and is not thread-safe. In addition, it modifies the static tm object which may be shared with gmtime and localtime. POSIX marks this function obsolete and recommends strftime instead.
The text has been machine-translated via Google Translate.
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.

[编辑] 为例

[编辑] 另请参阅

一个time_t对象转换为文本表示
Original:
converts a time_t object to a textual representation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
tm对象转换成自定义的文字表述
Original:
converts a tm object to custom textual representation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]