00001 /***************************** License ********************************** 00002 00003 Copyright (C) 2008 by Communicative Machines 00004 http://www.cmlabs.com All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library 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 GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 ************************************************************************/ 00021 #ifndef _TIME_WINCE_H 00022 #define _TIME_WINCE_H 1 00023 00024 #include <winbase.h> 00025 // #include <sys/types.h> 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 extern int daylight; 00032 // extern int _timezone, timezone; 00033 extern char *tzname[2]; 00034 00035 #if 0 00036 #define _DAY_SEC (24L * 60L * 60L) /* secs in a day */ 00037 #define _YEAR_SEC (365L * _DAY_SEC) /* secs in a year */ 00038 #define _FOUR_YEAR_SEC (1461L * _DAY_SEC) /* secs in a 4 year interval */ 00039 #define _DEC_SEC 315532800L /* secs in 1970-1979 */ 00040 #define _BASE_YEAR 70L /* 1970 is the base year */ 00041 #define _BASE_DOW 4 /* 01-01-70 was a Thursday */ 00042 #define _LEAP_YEAR_ADJUST 17L /* Leap years 1900 - 1970 */ 00043 #define _MAX_YEAR 138L /* 2038 is the max year */ 00044 #endif 00045 00046 #ifndef _TM_DEFINED 00047 struct tm { 00048 int tm_sec; /* seconds after the minute - [0,59] */ 00049 int tm_min; /* minutes after the hour - [0,59] */ 00050 int tm_hour; /* hours since midnight - [0,23] */ 00051 int tm_mday; /* day of the month - [1,31] */ 00052 int tm_mon; /* months since January - [0,11] */ 00053 int tm_year; /* years since 1900 */ 00054 int tm_wday; /* days since Sunday - [0,6] */ 00055 int tm_yday; /* days since January 1 - [0,365] */ 00056 int tm_isdst; /* daylight savings time flag */ 00057 }; 00058 #define _TM_DEFINED 00059 #endif 00060 00061 00062 typedef struct { 00063 int yr; // year of interest 00064 int yd; // day of year 00065 long ms; // milli-seconds in the day 00066 } transitionTime; 00067 00068 time_t mktime(struct tm* pt); 00069 time_t time( time_t *timer ); 00070 struct tm *localtime(const time_t *ptime); 00071 struct tm *gmtime(const time_t *tod); 00072 char* ctime( const time_t *t ); 00073 char* asctime(const struct tm *tptr); 00074 void tzset(); 00075 // int clock(void); 00076 time_t wce_FILETIME2time_t(const FILETIME* pf); 00077 00078 00079 struct timeb { 00080 time_t time; 00081 unsigned short millitm; 00082 short timezone; 00083 short dstflag; 00084 }; 00085 /* struct tm* localtime(time_t *t); 00086 struct tm* gmtime(time_t *t); 00087 unsigned long time(time_t *t); 00088 int ftime_gmt(struct timeb *tp);*/ 00089 int ftime(struct timeb *tp); 00090 struct timeb Filetime2timeb(FILETIME * ptr); 00091 00092 00093 #ifdef __cplusplus 00094 }; 00095 #endif 00096 00097 #endif 00098