00001 /* clib/include/time.h 00002 * 00003 * Provides access to time and time based operations in ABLE. 00004 * Some care has been taken to make this as compatible as possible with 00005 * other operating systems. Hence the __USE_BSD stuff. 00006 * 00007 * Copyright 2003 Simtec Electronics 00008 * 00009 * Permission is hereby granted, free of charge, to any person 00010 * obtaining a copy of this software and associated documentation 00011 * files (the "Software"), to deal in the Software without 00012 * restriction, including without limitation the rights to use, copy, 00013 * modify, merge, publish, distribute, sublicense, and/or sell copies 00014 * of the Software, and to permit persons to whom the Software is 00015 * furnished to do so, subject to the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00023 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00024 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00025 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00026 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00027 * SOFTWARE. 00028 * 00029 */ 00030 00031 #ifndef _ABLE_CLIB_TIME_H 00032 #define _ABLE_CLIB_TIME_H 1 00033 00034 #include <sys/types.h> 00035 00036 #define CLOCKS_PER_SEC 1000000l 00037 typedef unsigned long clock_t; 00038 00040 struct tm 00041 { 00042 int tm_sec; 00043 int tm_min; 00044 int tm_hour; 00045 int tm_mday; 00046 int tm_mon; 00047 int tm_year; 00048 int tm_wday; 00049 int tm_yday; 00050 int tm_isdst; 00052 #ifdef __USE_BSD 00053 long int tm_gmtoff; 00054 __const char *tm_zone; 00055 #else 00056 long int __tm_gmtoff; 00057 __const char *__tm_zone; 00058 #endif 00059 }; 00060 00061 clock_t clock(void); 00062 00063 char *asctime(const struct tm *tm); 00064 char *asctime_r(const struct tm *tm, char *buf); 00065 00066 char *ctime(const time_t *timep); 00067 char *ctime_r(const time_t *timep, char *buf); 00068 00069 struct tm *gmtime(const time_t *timep); 00070 struct tm *gmtime_r(const time_t *timep, struct tm *result); 00071 00072 struct tm *localtime(const time_t *timep); 00073 struct tm *localtime_r(const time_t *timep, struct tm *result); 00074 00088 time_t mktime(struct tm *tm); 00089 00106 size_t strftime(char *s, size_t max, const char *format,const struct tm *tm); 00107 00108 #define difftime(t1,t0) (double)(t1 - t0) 00109 00117 time_t time(time_t *t); 00118 00119 #endif /* _ABLE_CLIB_TIME_H */