00001 /** 00002 * \addtogroup timer 00003 * @{ 00004 */ 00005 00006 /** 00007 * \file 00008 * Timer library header file. 00009 * \author 00010 * Adam Dunkels <adam@sics.se> 00011 */ 00012 00013 /* 00014 * Copyright (c) 2004, Swedish Institute of Computer Science. 00015 * All rights reserved. 00016 * 00017 * Redistribution and use in source and binary forms, with or without 00018 * modification, are permitted provided that the following conditions 00019 * are met: 00020 * 1. Redistributions of source code must retain the above copyright 00021 * notice, this list of conditions and the following disclaimer. 00022 * 2. Redistributions in binary form must reproduce the above copyright 00023 * notice, this list of conditions and the following disclaimer in the 00024 * documentation and/or other materials provided with the distribution. 00025 * 3. Neither the name of the Institute nor the names of its contributors 00026 * may be used to endorse or promote products derived from this software 00027 * without specific prior written permission. 00028 * 00029 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 00030 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00031 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00032 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 00033 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00034 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00035 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00036 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00037 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00038 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00039 * SUCH DAMAGE. 00040 * 00041 * This file is part of the Contiki operating system. 00042 * 00043 * Author: Adam Dunkels <adam@sics.se> 00044 * 00045 * $Id: timer.h,v 1.6 2005/06/10 18:14:36 adam Exp $ 00046 */ 00047 #ifndef __TIMER_H__ 00048 #define __TIMER_H__ 00049 00050 #include "clock.h" 00051 00052 /** 00053 * A timer. 00054 * 00055 * This structure is used for declaring a timer. The timer must be set 00056 * with timer_set() before it can be used. 00057 * 00058 * \hideinitializer 00059 */ 00060 struct timer { 00061 clock_time_t start; 00062 clock_time_t interval; 00063 }; 00064 00065 void timer_set(struct timer *t, clock_time_t interval); 00066 void timer_reset(struct timer *t); 00067 void timer_restart(struct timer *t); 00068 int timer_expired(struct timer *t); 00069 00070 #endif /* __TIMER_H__ */
1.3.6