[glib/wip/monotonic: 2/9] Add 'GTimeSpec' as 'struct timespec' equivalent



commit 3fb6242afbf93d9dafbb40476a8efd70d5d51132
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Oct 22 17:28:46 2010 +0200

    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(+), 0 deletions(-)
---
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 0a818b8..8142584 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -1318,6 +1318,9 @@ g_time_val_from_iso8601
 g_time_val_to_iso8601
 
 <SUBSECTION>
+GTimeSpec
+
+<SUBSECTION>
 GDate
 GTime
 GDateDMY
diff --git a/docs/reference/glib/tmpl/date.sgml b/docs/reference/glib/tmpl/date.sgml
index d097edb..54b38cb 100644
--- a/docs/reference/glib/tmpl/date.sgml
+++ b/docs/reference/glib/tmpl/date.sgml
@@ -134,6 +134,14 @@ length of the sleep.
 @Returns: 
 
 
+<!-- ##### STRUCT GTimeSpec ##### -->
+<para>
+
+</para>
+
+ tv_sec: 
+ tv_nsec: 
+
 <!-- ##### STRUCT GDate ##### -->
 <para>
 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 da5bfea..31473c6 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 <structname>struct timespec</structname>.
+ *
+ * Since: 2.28
+ **/
+
 static void
 g_main_dispatch_free (gpointer dispatch)
 {
diff --git a/glib/gtypes.h b/glib/gtypes.h
index e616f99..0b843c6 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -33,6 +33,7 @@
 
 #include <glibconfig.h>
 #include <glib/gmacros.h>
+#include <time.h>
 
 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]