gwenhywfar  4.3.3
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 
33 #include <gwenhywfar/gwenhywfarapi.h>
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 
53  int month,
54  int day,
55  int hour,
56  int min,
57  int sec,
58  int inUtc);
59 
94  const char *tmpl);
95 
97  const char *tmpl);
98 
100  const char *tmpl,
101  GWEN_BUFFER *buf);
103  const char *tmpl,
104  GWEN_BUFFER *buf);
105 
106 
113 
117 GWENHYWFAR_API uint32_t GWEN_Time_Seconds(const GWEN_TIME *t);
118 
121 
125 GWENHYWFAR_API double GWEN_Time_Diff(const GWEN_TIME *t1,
126  const GWEN_TIME *t0);
127 
132  const GWEN_TIME *t0);
133 
134 /* Compare t1 and t0. Return 0 if both are equal, -1 if t1<t0 and
135  * 1 if t1>t0
136  */
137 GWENHYWFAR_API int GWEN_Time_Compare(const GWEN_TIME *t1, const GWEN_TIME *t0);
138 
143 GWENHYWFAR_API int GWEN_Time_AddSeconds(GWEN_TIME *ti, uint32_t secs);
144 
149 GWENHYWFAR_API int GWEN_Time_SubSeconds(GWEN_TIME *ti, uint32_t secs);
150 
151 
156  int *hours,
157  int *mins,
158  int *secs);
159 
164  int *hours,
165  int *mins,
166  int *secs);
167 
172  int *days,
173  int *month,
174  int *year);
175 
180  int *days,
181  int *month,
182  int *year);
183 
188 GWENHYWFAR_API struct tm GWEN_Time_toTm(const GWEN_TIME *t);
189 
194 
195 
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 
202 
203 #endif
204