User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:time.h:ctime
click
to support this page (eg 0,42 € or so) Thanks.

Table of Contents

ctime

Description

The ctime() function shall convert the time pointed to by clock, representing time in seconds since the Epoch, to local time in the form of a string. It shall be equivalent to

   asctime(localtime(clock))

1970-01-01 00:00:00 +0000 (UTC).

return value

The ctime() function shall return the pointer returned by asctime() with that broken-down time as an argument.
Upon successful completion, ctime_r() shall return a pointer to the string pointed to by buf. When an error is encountered, a null pointer shall be returned.

ctime c example

/* 
 * ctime example code
 * http://code-reference.com/c/time.h/ctime 
 */
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t time_format;
 
    time(&time_format);
    printf("%s\n", ctime(&time_format));
 
    return 0;
}

output for this example

  
  Mon Apr 23 18:24:18 2012

see also

advertising
c/time.h/ctime.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum