home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / WEBSERVE / PI3 / PI3WEB.EXE / DEVEL / INCLUDE / PITimer.h < prev    next >
C/C++ Source or Header  |  1997-10-19  |  5KB  |  172 lines

  1. /*____________________________________________________________________________*\
  2.  *
  3.  
  4.  Copyright (c) 1997 John Roy. All rights reserved.
  5.  
  6.  These sources, libraries and applications are
  7.  FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
  8.  as long as the following conditions are adhered to.
  9.  
  10.  Redistribution and use in source and binary forms, with or without
  11.  modification, are permitted provided that the following conditions
  12.  are met:
  13.  
  14.  1. Redistributions of source code must retain the above copyright
  15.     notice, this list of conditions and the following disclaimer. 
  16.  
  17.  2. Redistributions in binary form must reproduce the above copyright
  18.     notice, this list of conditions and the following disclaimer in
  19.     the documentation and/or other materials provided with the
  20.     distribution.
  21.  
  22.  3. Redistributions of any form whatsoever and all advertising materials 
  23.     mentioning features must contain the following
  24.     acknowledgment:
  25.     "This product includes software developed by John Roy
  26.     (http://www.johnroy.com/pi3/)."
  27.  
  28.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  29.  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30.  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  31.  IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  32.  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34.  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36.  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37.  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  38.  OF THE POSSIBILITY OF SUCH DAMAGE.
  39.  
  40.  *____________________________________________________________________________*|
  41.  *
  42.  * $Source: PITimer.h$
  43.  * $Date: Sun Aug 10 06:29:39 1997$
  44.  *
  45.  Description:
  46.     Definition of timer functions.
  47. \*____________________________________________________________________________*/
  48. /* $HeaderTop:$ */
  49.  
  50. #ifndef PITIMER_H_
  51. #define PITIMER_H_
  52.  
  53. #include "PiAPI.h"
  54. #include "PISync.h"
  55. #include "PIThread.h"
  56.  
  57. /*____________________________________________________________________________*\
  58.  *
  59.  Typedefs:
  60. \*____________________________________________________________________________*/
  61. typedef struct Timer PITimer;
  62.  
  63. /*____________________________________________________________________________*\
  64.  *
  65.  Name:
  66.     PITimer_new
  67.  
  68.  Synopsis:
  69.     PITimer *PITimer_new()
  70.     
  71.  Description:
  72.     Allocates and returns a pointer to a new timer object.
  73.  
  74.  Notes:
  75.     Timer internals and API functions support microsecond resolution, however,
  76.     most operating systems will not support this granularity. Actual 
  77.     timer resolution is operating system dependant.
  78.  
  79.  Return Values:
  80.     Returns a pointer to a new Timer object.
  81.  
  82.  Errors:
  83.     On error PITimer_new() returns NULL. The function
  84.     PITimer_getLastError() can be used to get more specific
  85.     error information.
  86.  
  87.  See Also:
  88.     PITimer_delete()
  89. \*____________________________________________________________________________*/
  90. PUBLIC_PIAPI PITimer *PITimer_new();
  91.  
  92. /*____________________________________________________________________________*\
  93.  *
  94.  Name:
  95.     PITimer_reset
  96.  
  97.  Synopsis:
  98.     int PITimer_reset( PITimer *pTimer )
  99.     
  100.  Description:
  101.     Reset the timer to 0 seconds and 0 microseconds.
  102.  
  103.  Notes:
  104.  Return Values:
  105.     Returns PIAPI_COMPLETED on success.
  106.  
  107.  Errors:
  108.     On error PIAPI_ERROR is returned. The function PITimer_getLastError()
  109.     returns more specific error information.
  110.  
  111.  See Also:
  112.     PITimer_elapsed()
  113. \*____________________________________________________________________________*/
  114. PUBLIC_PIAPI int PITimer_reset( PITimer *pTimer );
  115.  
  116. /*____________________________________________________________________________*\
  117.  *
  118.  Name:
  119.     PITimer_elapsed
  120.  
  121.  Synopsis:
  122.     int PITimer_elapsed( PITimer *pTimer, long *plSeconds,
  123.         long *plMicroSeconds )
  124.     
  125.  Description:
  126.     Returns the number of seconds and microseconds elapsed since the
  127.     timer was last reset.
  128.  
  129.  Notes:
  130.     If plSeconds is NULL, the number of seconds will not be set.
  131.     If plMicroSeconds is NULL, the number of microseconds will not be set.
  132.  
  133.  Return Values:
  134.     Returns PIAPI_COMPLETED on success.
  135.  
  136.  Errors:
  137.     On error PIAPI_ERROR is returned. The function PITimer_getLastError()
  138.     returns more specific error information.
  139.  
  140.  See Also:
  141.     PITimer_reset()
  142. \*____________________________________________________________________________*/
  143. PUBLIC_PIAPI int PITimer_elapsed( PITimer *pTimer, long *plSeconds,
  144.         long *plMicroSeconds );
  145.  
  146. /*____________________________________________________________________________*\
  147.  *
  148.  Name:
  149.     PITimer_delete
  150.  
  151.  Synopsis:
  152.     int PITimer_delete( PITimer *pTimer )
  153.     
  154.  Description:
  155.     Destroys a timer object and deallocates memory associated with it.
  156.  
  157.  Notes:
  158.  Return Values:
  159.     Returns PIAPI_COMPLETED on success.
  160.  
  161.  Errors:
  162.     On error PIAPI_ERROR is returned. The function PITimer_getLastError()
  163.     returns more specific error information.
  164.  
  165.  See Also:
  166.     PITimer_new()
  167. \*____________________________________________________________________________*/
  168. PUBLIC_PIAPI int PITimer_delete( PITimer *pTimer );
  169.  
  170. #endif    /* PITIMER_H_ */
  171.  
  172.