Download API User Manual

Transcript
LinuxDA API User Manual
9. Standard Linux Lib Functions
This section provides some useful standard linux lib functions.
1. time
1.time
1. 1 Fundmental definations
struct tm { // a broken-down time
int tm_sec;
//seconds after the minute. Normally in the range [0 ,59],but can be up to
61 to allow for leap second.
int tm_min;
//minutes after the hour, [0,59]
int tm_hour;
//hours after midnight.[0,59]
int tm_mday;
//day of the month.[1,31]
int tm_mon;
//month of the year since January. [0,11].
int tm_year;
//the number of year since 1900.
int tm_wday;
//day of week.[0,6].
int tm_yday;
//day in the year. [0,365].
int tm_isdst;
//daylight saving time.
};
struct tm representing broken-down time which is binary representation separate into year,
month, day etc.Broken-down time is stored in the structure tm which is defined in <time.h>.
time_t a long integer 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.
2. 1 Some functions about time.
struct tm *gmtime(const time_t *timep);
converts the calendar time timep into broken-down time representation, expressed in Coordinated
Universal Time.
struct tm *localtime (const time_t *timep);
converts the calendar time timep into broken-down time representation,expressed in local time.
time_t mktime (struct tm *timeptr);
convert a local broken time to a calendar time.
int stime(time_t *t);
set the system time as the value of *t.
69