00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2009 John E. Stone 00004 *cr 00005 ***************************************************************************/ 00006 /*************************************************************************** 00007 * RCS INFORMATION: 00008 * 00009 * $RCSfile: WKFUtils.h,v $ 00010 * $Author: johns $ $Locker: $ $State: Exp $ 00011 * $Revision: 1.2 $ $Date: 2020/02/26 06:23:21 $ 00012 * 00013 ***************************************************************************/ 00027 /* 00028 * Copyright (c) 1994-2009 John E. Stone 00029 * All rights reserved. 00030 * 00031 * Redistribution and use in source and binary forms, with or without 00032 * modification, are permitted provided that the following conditions 00033 * are met: 00034 * 1. Redistributions of source code must retain the above copyright 00035 * notice, this list of conditions and the following disclaimer. 00036 * 2. Redistributions in binary form must reproduce the above copyright 00037 * notice, this list of conditions and the following disclaimer in the 00038 * documentation and/or other materials provided with the distribution. 00039 * 3. The name of the author may not be used to endorse or promote products 00040 * derived from this software without specific prior written permission. 00041 * 00042 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 00043 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00044 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00045 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00046 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00047 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00048 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00049 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00050 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00051 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00052 * SUCH DAMAGE. 00053 */ 00054 00055 #ifndef WKF_UTILS_INC 00056 #define WKF_UTILS_INC 1 00057 00058 #ifdef __cplusplus 00059 extern "C" { 00060 #endif 00061 00062 typedef void * wkf_timerhandle; 00063 wkf_timerhandle wkf_timer_create(void); 00064 void wkf_timer_destroy(wkf_timerhandle); 00065 void wkf_timer_start(wkf_timerhandle); 00066 void wkf_timer_stop(wkf_timerhandle); 00067 double wkf_timer_time(wkf_timerhandle); 00068 double wkf_timer_timenow(wkf_timerhandle); 00069 double wkf_timer_start_time(wkf_timerhandle); 00070 double wkf_timer_stop_time(wkf_timerhandle); 00071 00072 typedef struct { 00073 wkf_timerhandle timer; 00074 double updatetime; 00075 } wkfmsgtimer; 00076 00078 extern wkfmsgtimer * wkf_msg_timer_create(double updatetime); 00079 00081 extern int wkf_msg_timer_timeout(wkfmsgtimer *time); 00082 00084 void wkf_msg_timer_destroy(wkfmsgtimer * mt); 00085 00086 #ifdef __cplusplus 00087 } 00088 #endif 00089 00090 #endif