- #include <time.h>
- time_t time(time_t *tloc);
- double difftime(time_t time1,time_t time0);
- struct tm *localtime(const time_t *timer);
- struct tm *gmtime(const time_t *timer);
- char *ctime(const time_t *timer); /*Notice! this is static store*/
- char *asctime(const struct tm *timer);
- struct tm{
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
- };
- /*important*/
- char *asctime_r(const struct tm *restrict timeptr,char *restrict buf);
- char *ctime_r(const time_t *clock, char *buf );
- struct tm *gmtime_r(const time_t *restrict timer,struct tm *restrict result);
- struct tm *localtime_r(const time_t *restrict timer,struct tm *restrict resul);
- #include <sys/time.h>
- int gettimeofday(struct timeval *restrict tp,void *restrict tzp/*set NULL*/);
- struct timeval{
- time_t tv_sec;
- time_t tv_usec;/*微秒*/
- };
- struct timespec{
- time_t tv_sec;
- time_t tv_nsec;
- }
- int nanosleep(const struct timespec *rqtp,struct timespec *rmtp);
- struct tms{
- clock_t tms_utime;
- clock_t tms_stime;
- clock_t tms_cutime;
- clock_t tms_cstime;
- }
- clock_t times(struct tms *buffer);
- struct itimerval{
- struct timeval it_value;
- struct timeval it_interval;
- }
- /*
- which will be ITIMER_REAL,ITIMER_VIRTUAL,ITIMER_PROF
- if which was set ITIMER_REAL,when time to send SIGALRM signal
- if which was set ITIMER_VIRTUAL,when time to send SIGVTALRM signal
- if which was set ITIMER_PROF,when time to send SIGPROF signal
- */
- int getitimer(int which,struct itimerval *value);
- int setitimer(int which,const struct itimerval *restrict value,struct itimerval *restrict
- ovalue);
- POSIX:TMR
- int timer_creat(clockid_t clock_id,struct sigevent *restrict evp,timer_t *restrict timerid);
- int timer_delete(timer_t timerid);
- int timer_getoverrun(timer_t timerid);
- int timer_gettime(timer_t timerid,struct itimerspec *value);
- int timer_settime(timer_t timerid,int falgs,const struct itimerspec *value,struct itimerspec
- *ovalue);
- struct itimerspec{
- struct timespec it_value;
- struct timespec it_interval;
- };
时间记录
最新推荐文章于 2023-08-12 10:21:50 发布
