gwenhywfar  5.11.1beta
gwentime.h
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  cvs : $Id$
5  begin : Wed Mar 24 2004
6  copyright : (C) 2004 by Martin Preuss
7  email : martin@libchipcard.de
8 
9  ***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU Lesser General Public *
13  * License as published by the Free Software Foundation; either *
14  * version 2.1 of the License, or (at your option) any later version. *
15  * *
16  * This library is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19  * Lesser General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library; if not, write to the Free Software *
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
24  * MA 02111-1307 USA *
25  * *
26  ***************************************************************************/
27 
28 
29 #ifndef GWEN_TIME_H
30 #define GWEN_TIME_H
31 
32 
34 #include <gwenhywfar/types.h>
35 #include <gwenhywfar/db.h>
36 #include <time.h>
37 
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 typedef struct GWEN_TIME GWEN_TIME;
44 
45 
48 
49 
51 
62  int month,
63  int day,
64  int hour,
65  int min,
66  int sec,
67  int inUtc);
68 
103  const char *tmpl);
104 
106  const char *tmpl);
107 
109  const char *tmpl,
110  GWEN_BUFFER *buf);
112  const char *tmpl,
113  GWEN_BUFFER *buf);
114 
115 
122 
127 
130 
135  const GWEN_TIME *t0);
136 
141  const GWEN_TIME *t0);
142 
143 /* Compare t1 and t0. Return 0 if both are equal, -1 if t1<t0 and
144  * 1 if t1>t0
145  */
147 
153 
159 
160 
165  int *hours,
166  int *mins,
167  int *secs);
168 
173  int *hours,
174  int *mins,
175  int *secs);
176 
181  int *days,
182  int *month,
183  int *year);
184 
189  int *days,
190  int *month,
191  int *year);
192 
193 #if 0
198 GWENHYWFAR_API struct tm GWEN_Time_toTm(const GWEN_TIME *t);
199 #endif
200 
205 
206 
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 
213 
214 #endif
215 
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
GWENHYWFAR_API int GWEN_Time_toDb(const GWEN_TIME *t, GWEN_DB_NODE *db)
GWENHYWFAR_API double GWEN_Time_DiffSeconds(const GWEN_TIME *t1, const GWEN_TIME *t0)
struct GWEN_TIME GWEN_TIME
Definition: gwentime.h:43
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromUtcString(const char *s, const char *tmpl)
GWENHYWFAR_API GWEN_TIME * GWEN_Time_new(int year, int month, int day, int hour, int min, int sec, int inUtc)
GWENHYWFAR_API uint32_t GWEN_Time_Seconds(const GWEN_TIME *t)
GWENHYWFAR_API int GWEN_Time_SubSeconds(GWEN_TIME *ti, uint32_t secs)
GWENHYWFAR_API GWEN_TIME * GWEN_Time_dup(const GWEN_TIME *t)
GWENHYWFAR_API int GWEN_Time_toString(const GWEN_TIME *t, const char *tmpl, GWEN_BUFFER *buf)
GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcTime(const GWEN_TIME *t, int *hours, int *mins, int *secs)
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromSeconds(uint32_t s)
GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcDate(const GWEN_TIME *t, int *days, int *month, int *year)
GWENHYWFAR_API int GWEN_Time_toUtcString(const GWEN_TIME *t, const char *tmpl, GWEN_BUFFER *buf)
GWENHYWFAR_API time_t GWEN_Time_toTime_t(const GWEN_TIME *t)
GWENHYWFAR_API void GWEN_Time_free(GWEN_TIME *t)
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromDb(GWEN_DB_NODE *db)
GWENHYWFAR_API int GWEN_Time_Compare(const GWEN_TIME *t1, const GWEN_TIME *t0)
GWENHYWFAR_API double GWEN_Time_Diff(const GWEN_TIME *t1, const GWEN_TIME *t0)
GWENHYWFAR_API int GWEN_Time_GetBrokenDownDate(const GWEN_TIME *t, int *days, int *month, int *year)
GWENHYWFAR_API double GWEN_Time_Milliseconds(const GWEN_TIME *t)
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromString(const char *s, const char *tmpl)
GWENHYWFAR_API GWEN_TIME * GWEN_CurrentTime(void)
GWENHYWFAR_API int GWEN_Time_AddSeconds(GWEN_TIME *ti, uint32_t secs)
GWENHYWFAR_API int GWEN_Time_GetBrokenDownTime(const GWEN_TIME *t, int *hours, int *mins, int *secs)