Programming/C / C++
struct tm
역시인생한방
2015. 2. 7. 19:03
#include <time.h>
struct tm
{
// seconds after the minute - [0,59]
int tm_sec;
// minutes after the hour - [0,59]
int tm_min;
// hours since midnight - [0,23]
int tm_hour;
// day of the month - [1,31]
int tm_mday;
// months since January - [0,11]
int tm_mon;
// years since 1900
int tm_year;
// days since Sunday - [0,6]
int tm_wday;
// days since January 1 - [0,365]
int tm_yday;
// daylight savings time flag
int tm_isdst;
};
Convert from a struct tm to a time_t function : time_t mktime( struct tm* ptm )
사용 예)
time_t t;
time(&t);
tm* tstruct;
tstruct = localtime(&t);
tstruct->tm_sec = 현재시간 중 초