gwenhywfar  4.3.3
gwendate.h
Go to the documentation of this file.
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 typedef struct GWEN_DATE GWEN_DATE;
00035 
00036 
00037 #include <gwenhywfar/gwentime.h>
00038 
00039 #include <time.h>
00040 
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 
00047 
00048 
00055 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromGregorian(int y, int m, int d);
00056 
00061 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromJulian(int julian);
00062 
00066 GWENHYWFAR_API GWEN_DATE *GWEN_Date_CurrentDate(void);
00067 
00068 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromString(const char *s);
00069 
00070 GWENHYWFAR_API GWEN_DATE *GWEN_Date_dup(const GWEN_DATE *ogd);
00071 
00072 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromTime(const GWEN_TIME *ti);
00073 
00074 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromLocalTime(time_t t);
00075 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromGmTime(time_t t);
00076 
00077 
00078 GWENHYWFAR_API GWEN_DATE *GWEN_Date_fromStringWithTemplate(const char *s, const char *tmpl);
00079 GWENHYWFAR_API int GWEN_Date_toStringWithTemplate(const GWEN_DATE *t,
00080                                                   const char *tmpl,
00081                                                   GWEN_BUFFER *buf);
00082 
00083 
00087 GWENHYWFAR_API void GWEN_Date_free(GWEN_DATE *gd);
00088 
00089 
00090 
00091 GWENHYWFAR_API const char *GWEN_Date_GetString(const GWEN_DATE *gd);
00092 
00093 
00094 GWENHYWFAR_API int GWEN_Date_DaysInMonth(const GWEN_DATE *gd);
00095 
00100 GWENHYWFAR_API int GWEN_Date_DaysInYear(const GWEN_DATE *gd);
00101 
00102 GWENHYWFAR_API int GWEN_Date_GetYear(const GWEN_DATE *gd);
00103 GWENHYWFAR_API int GWEN_Date_GetMonth(const GWEN_DATE *gd);
00104 GWENHYWFAR_API int GWEN_Date_GetDay(const GWEN_DATE *gd);
00105 GWENHYWFAR_API int GWEN_Date_WeekDay(const GWEN_DATE *gd);
00106 GWENHYWFAR_API int GWEN_Date_GetJulian(const GWEN_DATE *gd);
00107 
00108 
00109 GWENHYWFAR_API int GWEN_Date_IsLeapYear(int y);
00110 GWENHYWFAR_API int GWEN_Date_Compare(const GWEN_DATE *gd1, const GWEN_DATE *gd0);
00111 GWENHYWFAR_API int GWEN_Date_Diff(const GWEN_DATE *gd1, const GWEN_DATE *gd0);
00112 
00113 
00114 
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119 
00120 
00121 
00122 #endif
00123 
00124