TIME.h — Wikipedia
A wikipedia article, free l’encyclopéi.
char * asctime (const struct tm* tmptr )
- Converted
tmptr
in a character string in format Www Mmm dd hh:mm:ss yyyy , Or Www is the day of the week, Mmm is the month in letters, dd The day of the month, hh:mm:ss is time, and yyyy is the year. The chain is followed by a return to the line and an end of the chain, for a total of 26 characters. The result chain is allocated statically and shared by the functionsctime
Andasctime
. Each time one of the two functions is called, the content this chain is replaced.
clock_t clock (void)
- Returns an approximation of the processor time used by the process.
char* ctime (const time_t* timer )
- Converts the value
timer
in a chain in the same format asasctime
. The returned chain is allocated statically in a shared area withasctime
.ctime
uses the internal buffer ofgmtime
Andlocaltime
As a return pointer, a call to this function will therefore cause crushing.
double difftime (time_t Timer2 , time_t Timer1 )
- Returns the difference, expressed in seconds between two moments.
struct tm* gmtime (const time_t* timer )
- Converts a type value
time_t
In a TM structure in UTC time. This structure is allocated statically and shared by the functionsgmtime
,localtime
Andctime
. Each time one of these functions is called, the content of the structure is crushed.
struct tm* gmtime_r (const time_t* timer , struct tm* result )
- Converts a type value
time_t
In a TM structure in UTC time. The date is stored in the TM structure pointed out by result . This is a version compatible with the threads ofgmtime
.
struct tm* localtime (const time_t* timer )
- Converts a type value
time_t
in a TM structure at local time. This structure is allocated statically and shared by the functionsgmtime
,localtime
Andctime
. Each time one of these functions is called, the content of the structure is crushed.
time_t mktime (struct tm* ptm )
- Converts a structure
tm
in a type of typetime_t
. mktime Check the TM structure, by correcting the values of its attributes if they are poorly informed, and translates this structure into a valuetime_t
which has returned. The original values of the fields tm_wday And tm_yday (day of week and year) of ptm are ignored, but the fields are filled with the values that correspond to the calculated date. The value of tm_day is not checked until tm_wday And tm_yday are determined. In the event of an error, the function returns the value(time_t)-1
.
time_t time (time_t* timer )
- Gives current time. The value is stored in the object pointed out by
timer
. In the case wheretimer
is zero, the value has only passed as a result of the function. Standard C specifies that the typetime_t
is arithmetic, but that its encoding is not specified, which makes this type practically opaque. The POSIX standard specifies thattime_t
contains the number of seconds since (Unix time).
size_t strftime (char* s , size_t n , const char* format , const struct tm* tptr )
- Formed at the structure
tm
in a character string, written in s , which contains at most n characters.
CLK_PER_SEC
- Constant that defines the number of clock blows per second. It is used by the function clock() .
CLOCKS_PER_SEC
- Another name of CLK_PER_SEC used by a few libraries.
CLK_TCK
- An obsolete macro from CLK_PER_SEC.
clock_t
- Type of data returned by Clock ().
Generally defined by types int or long int . time_t
- Type of data returned by Time ().
Generally defined by types int or long int . struct tm
- Human representation and calendar of dates.
Calendar [ modifier | Modifier and code ]
The human representation of dates (“Broken-Down Time” in English) is represented in the standard library C by the structure struct
tm
Here are the members:
Member | Description |
---|---|
int tm_hour |
Time (0 – 23) |
int tm_isdst |
Indicator on the offset between winter and summer time: is 1 if the discrepancy is active, 0 if it is not and a negative value if the information is not available. |
int tm_mday |
Day of the month (1 – 31) |
int tm_min |
minutes (0 – 59) |
int tm_mon |
months (0 – 11, 0 corresponds to January) |
int tm_sec |
seconds (0 – 59) |
int tm_wday |
Day of the week (0-6, 0 corresponds to Sunday) |
int tm_yday |
Day of year (0 – 365) |
int tm_year |
number of years since 1900 |
- (in) The GNU C Library ReferenceManual , ( read online ) , « Calendar Time »
- (in) The Open Group BaseSpecifications , ( read online ) , «Gmtime»
Recent Comments