function
<ctime>
ctimechar* ctime (const time_t * timer);
Convert time_t value to string
Interprets the value pointed by timer as a calendar time and converts it to a C-string containing a human-readable version of the corresponding time and date, in terms of local time.The returned string has the following format:
Where Www is the weekday, Mmm the month (in letters), dd the day of the month, hh:mm:ss the time, and yyyy the year.
The string is followed by a new-line character ('\n'
) and terminated with a null-character.
This function is equivalent to:
1
asctime(localtime(timer))
The returned value points to an internal array whose validity or value may be altered by any subsequent call to asctime or ctime.
1
2
3
4
5
6
7
8
9
10
11
12
13
/* ctime example */
#include <stdio.h> /* printf */
#include <time.h> /* time_t, time, ctime */
int main ()
{
time_t rawtime;
time (&rawtime);
printf ("The current local time is: %s", ctime (&rawtime));
return 0;
}
The current local time is: Wed Feb 13 16:06:10 2013
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4