home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.7 KB  |  110 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_TIME_H
  11. #define _SYS_TIME_H
  12.  
  13. #ident    "@(#)/usr/include/sys/time.h.sl 1.1 4.0 12/08/90 65040 AT&T-USL"
  14.  
  15. /*
  16.  * Structure returned by gettimeofday(2) system call,
  17.  * and used in other calls.
  18.  */
  19.  
  20. #include <sys/types.h>
  21.  
  22. #if !defined(_POSIX_SOURCE) 
  23. struct timeval {
  24.     long    tv_sec;        /* seconds */
  25.     long    tv_usec;    /* and microseconds */
  26. };
  27.  
  28. struct timezone {
  29.     int    tz_minuteswest;    /* minutes west of Greenwich */
  30.     int    tz_dsttime;    /* type of dst correction */
  31. };
  32. #define    DST_NONE    0    /* not on dst */
  33. #define    DST_USA        1    /* USA style dst */
  34. #define    DST_AUST    2    /* Australian style dst */
  35. #define    DST_WET        3    /* Western European dst */
  36. #define    DST_MET        4    /* Middle European dst */
  37. #define    DST_EET        5    /* Eastern European dst */
  38. #define    DST_CAN        6    /* Canada */
  39. #define    DST_GB        7    /* Great Britain and Eire */
  40. #define    DST_RUM        8    /* Rumania */
  41. #define    DST_TUR        9    /* Turkey */
  42. #define    DST_AUSTALT    10    /* Australian style with shift in 1986 */
  43.  
  44. /*
  45.  * Operations on timevals.
  46.  *
  47.  * NB: timercmp does not work for >= or <=.
  48.  */
  49. #define    timerisset(tvp)        ((tvp)->tv_sec || (tvp)->tv_usec)
  50. #define    timercmp(tvp, uvp, cmp)    \
  51.     ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  52.      (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  53. #define    timerclear(tvp)        (tvp)->tv_sec = (tvp)->tv_usec = 0
  54.  
  55. /*
  56.  * Names of the interval timers, and structure
  57.  * defining a timer setting.
  58.  */
  59. #define    ITIMER_REAL    0
  60. #define    ITIMER_VIRTUAL    1
  61. #define    ITIMER_PROF    2
  62.  
  63. struct    itimerval {
  64.     struct    timeval it_interval;    /* timer interval */
  65.     struct    timeval it_value;    /* current value */
  66. };
  67.  
  68. /*
  69.  * Time expressed in seconds and nanoseconds
  70.  */
  71. #endif /* !defined(_POSIX_SOURCE) */ 
  72.  
  73. typedef struct     timestruc {
  74.     time_t         tv_sec;        /* seconds */
  75.     long        tv_nsec;    /* and nanoseconds */
  76. } timestruc_t;
  77.  
  78. #ifdef _KERNEL
  79. /*
  80.  * Bump a timestruc by a small number of nsec
  81.  */
  82.  
  83. #define    BUMPTIME(t, nsec, flag) { \
  84.     register timestruc_t    *tp = (t); \
  85. \
  86.     tp->tv_nsec += (nsec); \
  87.     if (tp->tv_nsec >= 1000000000) { \
  88.         tp->tv_nsec -= 1000000000; \
  89.         tp->tv_sec++; \
  90.         flag = 1; \
  91.     } \
  92. }
  93.  
  94. extern    timestruc_t    hrestime;
  95. #endif
  96.  
  97. #if !defined(_KERNEL) && !defined(_POSIX_SOURCE)
  98. #if defined(__STDC__)
  99. int adjtime(struct timeval *, struct timeval *);
  100. int getitimer(int, struct itimerval *);
  101. int setitimer(int, struct itimerval *, struct itimerval *);
  102. #endif /* __STDC__ */
  103. #if !defined(_XOPEN_SOURCE)
  104. #include <time.h>
  105. #endif
  106. #endif /* _KERNEL */
  107.  
  108.  
  109. #endif    /* _SYS_TIME_H */
  110.