From ac82e74895f5a094e07506e48b908188e03006d3 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Fri, 22 Oct 2010 17:28:46 +0200 Subject: [PATCH] Add 'GTimeSpec' as 'struct timespec' equivalent --- docs/reference/glib/glib-sections.txt | 3 +++ docs/reference/glib/tmpl/date.sgml | 8 ++++++++ glib/gmain.c | 9 +++++++++ glib/gtypes.h | 9 +++++++++ 4 files changed, 29 insertions(+) diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 4bc190082..d51ffc727 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -1319,6 +1319,9 @@ g_time_val_add g_time_val_from_iso8601 g_time_val_to_iso8601 + +GTimeSpec + GDate GTime diff --git a/docs/reference/glib/tmpl/date.sgml b/docs/reference/glib/tmpl/date.sgml index d097edbd3..54b38cbfb 100644 --- a/docs/reference/glib/tmpl/date.sgml +++ b/docs/reference/glib/tmpl/date.sgml @@ -134,6 +134,14 @@ length of the sleep. @Returns: + + + + + +@tv_sec: +@tv_nsec: + Represents a day between January 1, Year 1 and a few thousand years in diff --git a/glib/gmain.c b/glib/gmain.c index da5bfea76..31473c653 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -1812,6 +1812,15 @@ g_get_current_time (GTimeVal *result) #endif } +/** + * GTimeSpec: + * + * Represents a precise time, with seconds and nanoseconds. This is + * similar to POSIX struct timespec. + * + * Since: 2.28 + **/ + static void g_main_dispatch_free (gpointer dispatch) { diff --git a/glib/gtypes.h b/glib/gtypes.h index e616f9988..0b843c6a3 100644 --- a/glib/gtypes.h +++ b/glib/gtypes.h @@ -33,6 +33,7 @@ #include #include +#include G_BEGIN_DECLS @@ -423,6 +424,14 @@ struct _GTimeVal glong tv_usec; }; +typedef struct _GTimeSpec GTimeSpec; + +struct _GTimeSpec +{ + time_t tv_sec; + glong tv_nsec; +}; + G_END_DECLS /* We prefix variable declarations so they can