The function localtime() uses the value of time() to fill a tm
structure with the values that represent the corresponding time,
expressed in the local timezone.
struct tm localtime(int timestamp)
Example:
struct tm
{
int tm_sec; /* Seconds - [0,61] */
int tm_min; /* Minutes - [0,59] */
int tm_hour; /* Hours - [0,23] */
int tm_mday; /* Day of the month - [1,31] */
int tm_mon; /* Month in year - [0,11] */
int tm_year; /* Year since 1900 */
int tm_wday; /* Days since sunday (Weekday) - [0,6] */
int tm_yday; /* Days since new year (1.1.) - [0,365] */
int tm_isdst; /* Summertime-Flag */
};
void main ()
{
int rawtime;
struct tm ltime;
rawtime = time ();
ltime = localtime (rawtime);
printf("localtime %d %d %d %d %d %d %d %d %d\n",ltime.tm_sec,ltime.tm_min,ltime.tm_hour,ltime.tm_mday,ltime.tm_mon,ltime.tm_year,ltime.tm_wday,ltime.tm_yday,ltime.tm_isdst);
}