timehelp.h

/*
 * File Name:     timehelp.h
 * Author:        Jade Cheng
 * Date:          March 29, 2009
 * Course:        ICS 451
 * Assignment:    Project 2
 */

#ifndef TIMEHELP_H_
#define TIMEHELP_H_

#include "common.h"

/**
 * Adds two time values.
 *
 * @param time1 The first time value.
 * @param time2 The second time value.
 *
 * @return The sum.
 */
extern timeval time_add(timeval time1, timeval time2);

/**
 * Compares two time values.
 *
 * @param time1 The first time value.
 * @param time2 The second time value.
 *
 * @return A valud compatible with strcmp.
 */
extern int time_cmp(timeval time1, timeval time2);

/**
 * Returns the current time.
 *
 * @return The current time.
 */
extern timeval time_now(void);

/**
 * Returns a time duration for a number of seconds.
 *
 * @param seconds The number of seconds.
 *
 * @return The time duration.
 */
extern timeval time_seconds(int seconds);

/**
 * Subtracts two time values.
 *
 * @param time1 The first time value.
 * @param time2 The second time value.
 *
 * @return The difference.
 */
extern timeval time_sub(timeval time1, timeval time2);

#endif /* TIMEHELP_H_ */
Valid HTML 4.01 Valid CSS