00001 #ifndef __TIME_H 00002 #define __TIME_H 00003 00004 /* 00005 * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 * 3. Neither the name of the copyright holders nor the names of 00017 * contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS 00021 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00023 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE 00024 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00025 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00026 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00027 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00028 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00029 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00030 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00031 * SUCH DAMAGE. 00032 * 00033 * For additional information see http://www.ethernut.de/ 00034 * 00035 */ 00036 /* 00037 * $Log$ 00038 * Revision 1.9 2009/03/05 22:51:14 freckle 00039 * revert change and define time_t on __linux__ 00040 * 00041 * Revision 1.8 2009/03/05 22:16:57 freckle 00042 * use __NUT_EMULATION instead of __APPLE__, __linux__, or __CYGWIN__ 00043 * 00044 * Revision 1.7 2008/08/11 06:59:58 haraldkipp 00045 * BSD types replaced by stdint types (feature request #1282721). 00046 * 00047 * Revision 1.6 2005/01/19 17:03:35 freckle 00048 * forget to check in other cygwin fixes 00049 * 00050 * Revision 1.5 2004/04/07 12:13:57 haraldkipp 00051 * Matthias Ringwald's *nix emulation added 00052 * 00053 * Revision 1.4 2004/03/16 16:48:27 haraldkipp 00054 * Added Jan Dubiec's H8/300 port. 00055 * 00056 * Revision 1.3 2003/12/19 22:24:25 drsung 00057 * Dox written. 00058 * 00059 * Revision 1.2 2003/11/26 11:15:34 haraldkipp 00060 * Portability issues 00061 * 00062 * Revision 1.1 2003/11/24 18:11:03 drsung 00063 * first release 00064 * 00065 * 00066 */ 00067 00072 #include <compiler.h> 00073 #include <sys/types.h> 00074 00080 __BEGIN_DECLS 00084 typedef struct _tm tm; 00085 00095 struct _tm { 00096 int tm_sec; 00097 int tm_min; 00098 int tm_hour; 00099 int tm_mday; 00100 int tm_mon; 00101 int tm_year; 00102 int tm_wday; 00103 int tm_yday; 00104 int tm_isdst; 00105 }; 00106 00112 // time_t is defind on __APPLE__ and __CYGWIN, but not on __linux__ or on embedded systems 00113 #if !defined(__APPLE__) && !defined(__CYGWIN__) 00114 typedef long time_t; 00115 #endif 00116 00117 00118 00119 time_t time(time_t * timer); 00120 int gmtime_r(CONST time_t * timer, tm * theTime); 00121 tm *gmtime(CONST time_t * timer); 00122 int localtime_r(CONST time_t * timer, tm * theTime); 00123 tm *localtime(CONST time_t * timer); 00124 00125 int stime(time_t * timer); 00126 time_t mktime(tm * timeptr); 00127 time_t _mkgmtime(tm * timeptr); 00128 00137 extern int _daylight; 00138 00151 extern long _timezone; 00152 00161 extern long _dstbias; 00162 00163 __END_DECLS 00165 #endif