QOF  0.8.7
qoftime.h
Go to the documentation of this file.
1 /***************************************************************************
2  * qoftime.h - QofTime, 64bit UTC time handling (seconds).
3  * Rewritten from scratch for QOF 0.7.0
4  *
5  * Fri May 5 15:05:32 2006
6  * Copyright 2006 Neil Williams
7  * linux@codehelp.co.uk
8  ****************************************************************************/
9 /*
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef _QOFTIME_H
26 #define _QOFTIME_H
27 
90 #include "config.h"
91 #include <time.h>
92 
94 #define QOF_MOD_TIME "qof-time"
95 
97 #define QOF_NSECS 1000000000
98 
112 typedef struct QofTime64 QofTime;
113 
121 typedef gint64 QofTimeSecs;
122 
132 void
134 
144 QofTime *
146 
152 QofTime *
153 qof_time_new (void);
154 
162 QofTime *
163 qof_time_copy (const QofTime *qt);
164 
166 void
167 qof_time_free (QofTime * qt);
168 
176 void
177 qof_time_set_secs (QofTime * time, QofTimeSecs secs);
178 
185 void
186 qof_time_set_nanosecs (QofTime * time, glong nano);
187 
195 qof_time_get_secs (const QofTime * time);
196 
203 glong
204 qof_time_get_nanosecs (const QofTime * time);
210 gboolean
211 qof_time_equal (const QofTime * ta, const QofTime * tb);
212 
214 gint
215 qof_time_cmp (const QofTime * ta, const QofTime * tb);
216 
226 QofTime *
227 qof_time_diff (const QofTime * ta, const QofTime * tb);
228 
234 QofTime *
235 qof_time_abs (QofTime * t);
236 
237 gboolean
238 qof_time_is_valid (const QofTime * qt);
239 
249 QofTime *
250 qof_time_from_time_t (time_t t, glong nanosecs);
251 
261 QofTime *
262 qof_time_set (QofTimeSecs t, glong nanosecs);
263 
277 gboolean
278 qof_time_to_time_t (QofTime * ts, time_t * t, glong * nanosecs);
279 
292 QofTime *
293 qof_time_from_tm (struct tm *tm, glong nanosecs);
294 
302 gboolean
303 qof_time_to_gtimeval (QofTime * qt, GTimeVal * gtv);
304 
311 void
312 qof_time_from_gtimeval (QofTime * qt, GTimeVal * gtv);
313 
324 QofTime *
325 qof_time_dmy_to_time (guint8 day, guint8 month, guint16 year);
326 
340 gboolean
341 qof_time_to_dmy (QofTime * t, guint8 * day, guint8 * month, guint16 * year);
352 GDate *
353 qof_time_to_gdate (QofTime * time);
354 
363 QofTime *
364 qof_time_from_gdate (GDate * date);
365 
377 GTimeVal *
379 
390 QofTime *
391 qof_time_get_current (void);
392 
401 gboolean
403 
412 gboolean
414 
423 gboolean
425 
434 guint8
436 
443 QofTime *
445 
447 QofTime *
449 
455 gchar *
456 qof_time_stamp_now (void);
457 
461 #endif /* _QOFTIME_H */