00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _QOFTIME_H
00026 #define _QOFTIME_H
00027
00090 #include "config.h"
00091 #include <time.h>
00092
00094 #define QOF_MOD_TIME "qof-time"
00095
00096 #ifndef QOF_DISABLE_DEPRECATED
00097 typedef struct timespec64
00098 {
00099 guint64 tv_sec;
00100 glong tv_nsec;
00101 }Timespec;
00102 #endif
00103
00105 #define QOF_NSECS 1000000000
00106
00120 typedef struct QofTime64 QofTime;
00121
00129 typedef gint64 QofTimeSecs;
00130
00140 void
00141 qof_time_add_secs (QofTime * qt, QofTimeSecs secs);
00142
00152 QofTime *
00153 qof_time_add_secs_copy (QofTime * qt, QofTimeSecs secs);
00154
00160 QofTime *
00161 qof_time_new (void);
00162
00170 QofTime *
00171 qof_time_copy (const QofTime *qt);
00172
00174 void
00175 qof_time_free (QofTime * qt);
00176
00184 void
00185 qof_time_set_secs (QofTime * time, QofTimeSecs secs);
00186
00193 void
00194 qof_time_set_nanosecs (QofTime * time, glong nano);
00195
00202 QofTimeSecs
00203 qof_time_get_secs (const QofTime * time);
00204
00211 glong
00212 qof_time_get_nanosecs (const QofTime * time);
00218 gboolean
00219 qof_time_equal (const QofTime * ta, const QofTime * tb);
00220
00222 gint
00223 qof_time_cmp (const QofTime * ta, const QofTime * tb);
00224
00234 QofTime *
00235 qof_time_diff (const QofTime * ta, const QofTime * tb);
00236
00242 QofTime *
00243 qof_time_abs (QofTime * t);
00244
00245 gboolean
00246 qof_time_is_valid (const QofTime * qt);
00247
00257 QofTime *
00258 qof_time_from_time_t (time_t t, glong nanosecs);
00259
00269 QofTime *
00270 qof_time_set (QofTimeSecs t, glong nanosecs);
00271
00285 gboolean
00286 qof_time_to_time_t (QofTime * ts, time_t * t, glong * nanosecs);
00287
00300 QofTime *
00301 qof_time_from_tm (struct tm *tm, glong nanosecs);
00302
00310 gboolean
00311 qof_time_to_gtimeval (QofTime * qt, GTimeVal * gtv);
00312
00319 void
00320 qof_time_from_gtimeval (QofTime * qt, GTimeVal * gtv);
00321
00332 QofTime *
00333 qof_time_dmy_to_time (guint8 day, guint8 month, guint16 year);
00334
00348 gboolean
00349 qof_time_to_dmy (QofTime * t, guint8 * day, guint8 * month, guint16 * year);
00360 GDate *
00361 qof_time_to_gdate (QofTime * time);
00362
00371 QofTime *
00372 qof_time_from_gdate (GDate * date);
00373
00385 GTimeVal *
00386 qof_time_get_current_start (void);
00387
00398 QofTime *
00399 qof_time_get_current (void);
00400
00409 gboolean
00410 qof_time_set_day_middle (QofTime * t);
00411
00420 gboolean
00421 qof_time_set_day_start (QofTime * time);
00422
00431 gboolean
00432 qof_time_set_day_end (QofTime * time);
00433
00442 guint8
00443 qof_time_last_mday (QofTime * ts);
00444
00451 QofTime *
00452 qof_time_get_today_start (void);
00453
00455 QofTime *
00456 qof_time_get_today_end (void);
00457
00463 gchar *
00464 qof_time_stamp_now (void);
00465
00469 #endif