본문 바로가기
C 언어

ctime_r

by SpeeDr00t 2016. 7. 9.
반응형

ctime_r

/*
NAME
       asctime,   ctime,   gmtime,   localtime,  mktime,  asctime_r,  ctime_r,
       gmtime_r, localtime_r - transform date and time to broken-down time  or
       ASCII
SYNOPSIS
       #include <time.h>
       char *asctime(const struct tm *tm);
       char *asctime_r(const struct tm *tm, char *buf);
       char *ctime(const time_t *timep);
       char *ctime_r(const time_t *timep, char *buf);
       struct tm *gmtime(const time_t *timep);
       struct tm *gmtime_r(const time_t *timep, struct tm *result);
       struct tm *localtime(const time_t *timep);
       struct tm *localtime_r(const time_t *timep, struct tm *result);
       time_t mktime(struct tm *tm);
DESCRIPTION
       The ctime(), gmtime() and localtime() functions all take an argument of
       data type time_t which represents calendar time.  When  interpreted  as
       an  absolute  time  value,  it represents the number of seconds elapsed
       since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
       The asctime() and mktime() functions both take an argument representing
       broken-down  time which is a representation separated into year, month,
       day, etc.
*/      
#include <time.h>
#include <stdio.h>
 
int main( int argc , char ** argv )
{
   time_t ltime;
   char buf[50];
 
   printf("the time is %s", ctime_r(<ime, buf));
 
return 0; 
}
반응형

'C 언어' 카테고리의 다른 글

tsearch  (0) 2016.07.09
system  (0) 2016.07.09
count  (0) 2016.07.09
copy  (0) 2016.07.09
replace  (0) 2016.07.09