00001 /*************************************************************************** 00002 begin : Tue Jul 07 2009 00003 copyright : (C) 2009 by Martin Preuss 00004 email : martin@libchipcard.de 00005 00006 *************************************************************************** 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00021 * MA 02111-1307 USA * 00022 * * 00023 ***************************************************************************/ 00024 00025 #ifndef GWEN_DATE_H 00026 #define GWEN_DATE_H 00027 00028 00029 #include <gwenhywfar/gwenhywfarapi.h> 00030 #include <gwenhywfar/types.h> 00031 #include <gwenhywfar/buffer.h> 00032 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 00039 00040 typedef struct GWEN_DATE GWEN_DATE; 00041 00042 00043 00044 00045 00052 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromGregorian(int y, int m, int d); 00053 00058 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromJulian(int julian); 00059 00063 GWENHYWFAR_API GWEN_DATE *GWEN_Date_CurrentDate(); 00064 00065 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromString(const char *s); 00066 00067 GWENHYWFAR_API GWEN_DATE *GWEN_Date_dup(const GWEN_DATE *ogd); 00068 00069 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromStringWithTemplate(const char *s, const char *tmpl); 00070 GWENHYWFAR_API int GWEN_Date_toStringWithTemplate(const GWEN_DATE *t, 00071 const char *tmpl, 00072 GWEN_BUFFER *buf); 00073 00074 00078 GWENHYWFAR_API void GWEN_Date_free(GWEN_DATE *gd); 00079 00080 00081 00082 GWENHYWFAR_API const char *GWEN_Date_GetString(const GWEN_DATE *gd); 00083 00084 00085 GWENHYWFAR_API int GWEN_Date_DaysInMonth(const GWEN_DATE *gd); 00086 00087 GWENHYWFAR_API int GWEN_Date_DaysInYear(const GWEN_DATE *gd); 00088 00089 GWENHYWFAR_API int GWEN_Date_GetYear(const GWEN_DATE *gd); 00090 GWENHYWFAR_API int GWEN_Date_GetMonth(const GWEN_DATE *gd); 00091 GWENHYWFAR_API int GWEN_Date_GetDay(const GWEN_DATE *gd); 00092 GWENHYWFAR_API int GWEN_Date_WeekDay(const GWEN_DATE *gd); 00093 GWENHYWFAR_API int GWEN_Date_GetJulian(const GWEN_DATE *gd); 00094 00095 00096 GWENHYWFAR_API int GWEN_Date_IsLeapYear(int y); 00097 GWENHYWFAR_API int GWEN_Date_Compare(const GWEN_DATE *gd1, const GWEN_DATE *gd0); 00098 GWENHYWFAR_API int GWEN_Date_Diff(const GWEN_DATE *gd1, const GWEN_DATE *gd0); 00099 00100 00101 00102 00103 #ifdef __cplusplus 00104 } 00105 #endif 00106 00107 00108 00109 #endif 00110 00111