home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / timeval_md.h < prev    next >
C/C++ Source or Header  |  1997-11-24  |  2KB  |  48 lines

  1. /*
  2.  * @(#)timeval_md.h    1.6 96/11/23
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. #ifndef    _WIN32_TIMEVAL_H_
  24. #define    _WIN32_TIMEVAL_H_
  25.  
  26. typedef struct {
  27.     long tv_sec;
  28.     long tv_usec;
  29. } timeval_t;
  30.  
  31. /*
  32.  * Operations on timevals.
  33.  *
  34.  * NB: timercmp does not work for >=, <= or ==.
  35.  */
  36. #define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
  37. #define timercmp(tvp, uvp, cmp) \
  38.         ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  39.          (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  40. #define timereq(tvp, uvp) \
  41.          ((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec == (uvp)->tv_usec)
  42. #define timerclear(tvp)         (tvp)->tv_sec = (tvp)->tv_usec = 0
  43.  
  44. void timeradd(timeval_t*, timeval_t*);
  45. void timersub(timeval_t*, timeval_t*);
  46.  
  47. #endif /* !_WIN32_TIMEVAL_H_ */
  48.