📄 time.h
字号:
/* time.h -- An implementation of the standard Unix <sys/time.h> file. Written by Geoffrey Noer <noer@cygnus.com> Public domain; no rights reserved. */#ifndef _SYS_TIME_H_#define _SYS_TIME_H_#include <_ansi.h>#include <sys/types.h>#ifdef __cplusplusextern "C" {#endif#ifndef _WINSOCK_Hstruct timeval { long tv_sec; long tv_usec;};struct timezone { int tz_minuteswest; int tz_dsttime;};#ifdef __CYGWIN__#include <sys/select.h>#endif /* __CYGWIN__ */#endif /* _WINSOCK_H */#define ITIMER_REAL 0#define ITIMER_VIRTUAL 1#define ITIMER_PROF 2struct itimerval { struct timeval it_interval; struct timeval it_value;};/* BSD time macros used by RTEMS code */#if defined (__rtems__) || defined (__CYGWIN__)/* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)#define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec))#define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ if ((result)->tv_usec >= 1000000) \ { \ ++(result)->tv_sec; \ (result)->tv_usec -= 1000000; \ } \ } while (0)#define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0)#endif /* defined (__rtems__) || defined (__CYGWIN__) */int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z));int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));int _EXFUN(utimes, (const char *__path, struct timeval *__tvp));int _EXFUN(getitimer, (int __which, struct itimerval *__value));int _EXFUN(setitimer, (int __which, const struct itimerval *__value, struct itimerval *__ovalue));#ifdef __cplusplus}#endif#endif /* _SYS_TIME_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -