00001 /* 00002 * c_time - time functions 00003 * 00004 * Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * vim: ft=c.doxygen ts=2 sw=2 et cindent 00021 */ 00022 00023 #ifndef _C_TIME_H 00024 #define _C_TIME_H 00025 00026 #include <time.h> 00027 #include <sys/time.h> 00028 00029 /** 00030 * @brief Calculate time difference 00031 * 00032 * The c_tspecdiff function returns the time elapsed between time time1 and time 00033 * time0 represented as timespec. 00034 * 00035 * @param time1 The time. 00036 * @param time0 The time. 00037 * 00038 * @return time elapsed between time1 and time0. 00039 */ 00040 struct timespec c_tspecdiff(struct timespec time1, struct timespec time0); 00041 00042 /** 00043 * @brief Calculate time difference. 00044 * 00045 * The function returns the time elapsed between time clock1 and time 00046 * clock0 represented as double (in seconds and milliseconds). 00047 * 00048 * @param clock1 The time. 00049 * @param clock0 The time. 00050 * 00051 * @return time elapsed between clock1 and clock0 in seconds and 00052 * milliseconds. 00053 */ 00054 double c_secdiff(struct timespec clock1, struct timespec clock0); 00055 00056 int c_utimes(const char *uri, const struct timeval *times); 00057 00058 #endif /* _C_TIME_H */