qoftime.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *        qoftime.h - QofTime, 64bit UTC time handling (seconds).
00003  *       Rewritten from scratch for QOF 0.7.0
00004  *
00005  *  Fri May  5 15:05:32 2006
00006  *  Copyright  2006  Neil Williams
00007  *  linux@codehelp.co.uk
00008  ****************************************************************************/
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA  02110-1301,  USA
00023  */
00024 
00025 #ifndef _QOFTIME_H
00026 #define _QOFTIME_H
00027 
00090 #include "config.h"
00092 #define QOF_MOD_TIME "qof-time"
00093 
00094 typedef struct timespec64
00095 {
00096    guint64 tv_sec;
00097    glong tv_nsec;
00098 }Timespec;
00099 
00101 #define QOF_NSECS 1000000000
00102 
00116 typedef struct QofTime64 QofTime;
00117 
00125 typedef gint64 QofTimeSecs;
00126 
00136 void
00137 qof_time_add_secs (QofTime * qt, QofTimeSecs secs);
00138 
00148 QofTime *
00149 qof_time_add_secs_copy (QofTime * qt, QofTimeSecs secs);
00150 
00156 QofTime *
00157 qof_time_new (void);
00158 
00166 QofTime *
00167 qof_time_copy (const QofTime *qt);
00168 
00170 void 
00171 qof_time_free (QofTime * qt);
00172 
00180 void 
00181 qof_time_set_secs (QofTime * time, QofTimeSecs secs);
00182 
00189 void 
00190 qof_time_set_nanosecs (QofTime * time, glong nano);
00191 
00198 QofTimeSecs 
00199 qof_time_get_secs (const QofTime * time);
00200 
00207 glong 
00208 qof_time_get_nanosecs (const QofTime * time);
00214 gboolean 
00215 qof_time_equal (const QofTime * ta, const QofTime * tb);
00216 
00218 gint 
00219 qof_time_cmp (const QofTime * ta, const QofTime * tb);
00220 
00230 QofTime *
00231 qof_time_diff (const QofTime * ta, const QofTime * tb);
00232 
00238 QofTime *
00239 qof_time_abs (QofTime * t);
00240 
00241 gboolean
00242 qof_time_is_valid (const QofTime * qt);
00243 
00253 QofTime *
00254 qof_time_from_time_t (time_t t, glong nanosecs);
00255 
00265 QofTime *
00266 qof_time_set (QofTimeSecs t, glong nanosecs);
00267 
00281 gboolean 
00282 qof_time_to_time_t (QofTime * ts, time_t * t, glong * nanosecs);
00283 
00296 QofTime *
00297 qof_time_from_tm (struct tm *tm, glong nanosecs);
00298 
00306 gboolean 
00307 qof_time_to_gtimeval (QofTime * qt, GTimeVal * gtv);
00308 
00315 void 
00316 qof_time_from_gtimeval (QofTime * qt, GTimeVal * gtv);
00317 
00328 QofTime *
00329 qof_time_dmy_to_time (guint8 day, guint8 month, guint16 year);
00330 
00344 gboolean
00345 qof_time_to_dmy (QofTime * t, guint8 * day, guint8 * month, guint16 * year);
00356 GDate *
00357 qof_time_to_gdate (QofTime * time);
00358 
00367 QofTime *
00368 qof_time_from_gdate (GDate * date);
00369 
00381 GTimeVal *
00382 qof_time_get_current_start (void);
00383 
00394 QofTime *
00395 qof_time_get_current (void);
00396 
00405 gboolean 
00406 qof_time_set_day_middle (QofTime * t);
00407 
00416 gboolean 
00417 qof_time_set_day_start (QofTime * time);
00418 
00427 gboolean 
00428 qof_time_set_day_end (QofTime * time);
00429 
00438 guint8 
00439 qof_time_last_mday (QofTime * ts);
00440 
00447 QofTime *
00448 qof_time_get_today_start (void);
00449 
00451 QofTime *
00452 qof_time_get_today_end (void);
00453 
00459 gchar *
00460 qof_time_stamp_now (void);
00461 
00465 #endif /* _QOFTIME_H */

Generated on Fri Sep 15 14:24:57 2006 for QOF by  doxygen 1.4.7