- Main Page
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# uip/timer.h

Go to the documentation of this file.

    00001 /**
    00002  * \defgroup timer Timer library
    00003  *
    00004  * The timer library provides functions for setting, resetting and
    00005  * restarting timers, and for checking if a timer has expired. An
    00006  * application must "manually" check if its timers have expired; this
    00007  * is not done automatically.
    00008  *
    00009  * A timer is declared as a \c struct \c timer and all access to the
    00010  * timer is made by a pointer to the declared timer.
    00011  *
    00012  * \note The timer library uses the \ref clock "Clock library" to
    00013  * measure time. Intervals should be specified in the format used by
    00014  * the clock library.
    00015  *
    00016  * @{
    00017  */
    00018
    00019
    00020 /**
    00021  * \file
    00022  * Timer library header file.
    00023  * \author
    00024  * Adam Dunkels <adam@sics.se>
    00025  */
    00026
    00027 /*
    00028  * Copyright (c) 2004, Swedish Institute of Computer Science.
    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. Neither the name of the Institute nor the names of its contributors
    00040  *    may be used to endorse or promote products derived from this software
    00041  *    without specific prior written permission.
    00042  *
    00043  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
    00044  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00045  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00046  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
    00047  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00048  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    00049  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00050  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    00051  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    00052  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00053  * SUCH DAMAGE.
    00054  *
    00055  * This file is part of the uIP TCP/IP stack
    00056  *
    00057  * Author: Adam Dunkels <adam@sics.se>
    00058  *
    00059  * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $
    00060  */
    00061 #ifndef __TIMER_H__
    00062 #define __TIMER_H__
    00063
    00064 #include "clock.h"
    00065
    00066 /**
    00067  * A timer.
    00068  *
    00069  * This structure is used for declaring a timer. The timer must be set
    00070  * with timer_set() before it can be used.
    00071  *
    00072  * \hideinitializer
    00073  */
    00074 struct timer {
    00075   clock_time_t start;
    00076   clock_time_t interval;
    00077 };
    00078
    00079 void timer_set(struct timer *t, clock_time_t interval);
    00080 void timer_reset(struct timer *t);
    00081 void timer_restart(struct timer *t);
    00082 int timer_expired(struct timer *t);
    00083
    00084 #endif /* __TIMER_H__ */
    00085
    00086 /** @} */