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 /* Until the rest of QOF is moved to QofTime this is needed. */
00095 #ifndef QOF_DISABLE_DEPRECATED
00096 typedef struct timespec64
00097 {
00098     guint64 tv_sec;
00099     glong tv_nsec;
00100 } Timespec;
00101 #endif
00102 
00103 #define QOF_NSECS 1000000000
00104 
00118 typedef struct QofTime64 QofTime;
00119 
00127 typedef gint64 QofTimeSecs;
00128 
00138 void
00139 qof_time_add_secs (QofTime * qt, QofTimeSecs secs);
00140 
00150 QofTime *
00151 qof_time_add_secs_copy (QofTime * qt, QofTimeSecs secs);
00152 
00158 QofTime *
00159 qof_time_new (void);
00160 
00168 QofTime *
00169 qof_time_copy (const QofTime *qt);
00170 
00172 void 
00173 qof_time_free (QofTime * qt);
00174 
00182 void 
00183 qof_time_set_secs (QofTime * time, QofTimeSecs secs);
00184 
00191 void 
00192 qof_time_set_nanosecs (QofTime * time, glong nano);
00193 
00200 QofTimeSecs 
00201 qof_time_get_secs (const QofTime * time);
00202 
00209 glong 
00210 qof_time_get_nanosecs (const QofTime * time);
00216 gboolean 
00217 qof_time_equal (const QofTime * ta, const QofTime * tb);
00218 
00220 gint 
00221 qof_time_cmp (const QofTime * ta, const QofTime * tb);
00222 
00232 QofTime *
00233 qof_time_diff (const QofTime * ta, const QofTime * tb);
00234 
00240 QofTime *
00241 qof_time_abs (QofTime * t);
00242 
00243 gboolean
00244 qof_time_is_valid (const QofTime * qt);
00245 
00255 QofTime *
00256 qof_time_from_time_t (time_t t, glong nanosecs);
00257 
00267 QofTime *
00268 qof_time_set (QofTimeSecs t, glong nanosecs);
00269 
00283 gboolean 
00284 qof_time_to_time_t (QofTime * ts, time_t * t, glong * nanosecs);
00285 
00298 QofTime *
00299 qof_time_from_tm (struct tm *tm, glong nanosecs);
00300 
00308 gboolean 
00309 qof_time_to_gtimeval (QofTime * qt, GTimeVal * gtv);
00310 
00317 void 
00318 qof_time_from_gtimeval (QofTime * qt, GTimeVal * gtv);
00319 
00330 QofTime *
00331 qof_time_dmy_to_time (guint8 day, guint8 month, guint16 year);
00332 
00346 gboolean
00347 qof_time_to_dmy (QofTime * t, guint8 * day, guint8 * month, guint16 * year);
00358 GDate *
00359 qof_time_to_gdate (QofTime * time);
00360 
00369 QofTime *
00370 qof_time_from_gdate (GDate * date);
00371 
00383 GTimeVal *
00384 qof_time_get_current_start (void);
00385 
00396 QofTime *
00397 qof_time_get_current (void);
00398 
00407 gboolean 
00408 qof_time_set_day_middle (QofTime * t);
00409 
00418 gboolean 
00419 qof_time_set_day_start (QofTime * time);
00420 
00429 gboolean 
00430 qof_time_set_day_end (QofTime * time);
00431 
00440 guint8 
00441 qof_time_last_mday (QofTime * ts);
00442 
00449 QofTime *
00450 qof_time_get_today_start (void);
00451 
00453 QofTime *
00454 qof_time_get_today_end (void);
00455 
00461 gchar *
00462 qof_time_stamp_now (void);
00463 
00467 #endif /* _QOFTIME_H */

Generated on Fri Sep 1 15:35:56 2006 for QOF by  doxygen 1.4.6