06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pREPC+ <strong>System</strong> <strong>Calls</strong> mktime<br />

mktime Converts the broken-down time into calendar time.<br />

#include <br />

time_t mktime (<br />

struct tm *timeptr /* broken-down time */<br />

)<br />

Description<br />

Arguments<br />

The mktime() function converts the broken-down time, expressed as local time, in<br />

the structure pointed to by timeptr into calendar time with the same encoding as<br />

the time() function. This function is primarily used to initialize the system time.<br />

The elements tm_wday and tm_yday are set by the function, so they need not be<br />

defined prior to the call. The original values of the other components are not<br />

restricted to the normal ranges (see below).<br />

Upon successful completion, the values of tm_wday and tm_yday are set<br />

appropriately, and the other components are set to represent the specified calendar<br />

time, but with their values forced to the normal ranges; the final value of tm_mday<br />

is not set until tm_mon and tm_year are determined.<br />

timeptr Points to a structure of type tm that stores the broken-down time.<br />

The tm structure is defined as follows. The semantics of the<br />

members and their normal ranges are expressed in the comments.<br />

struct tm {<br />

int tm_sec; /* seconds after the minute [0,61] */<br />

int tm_min; /* minutes after the hour [0,59] */<br />

int tm_hour; /* hours since midnight [0,23] */<br />

int tm_mday; /* day of the month [1,31] */<br />

int tm_mon; /* months since January [0,11] */<br />

int tm_year; /* years since 1900 */<br />

int tm_wday; /* days since Sunday [0,6] */<br />

int tm_yday; /* days since January 1 [0,365] */<br />

int tm_isdst; /* Daylight Saving Time flag */<br />

};<br />

The range [0, 61] for tm_sec allows for up to two leap seconds. The<br />

value of tm_isdst is positive if Daylight Saving Time is in effect,<br />

zero if Daylight Saving Time is not in effect, and negative if the<br />

information is not available.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 3-111<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!