Add 'GTimeSpec' as 'struct timespec' equivalent

This commit is contained in:
Ryan Lortie
2010-10-22 17:28:46 +02:00
parent 817b322ca7
commit ac82e74895
4 changed files with 29 additions and 0 deletions

View File

@@ -1319,6 +1319,9 @@ g_time_val_add
g_time_val_from_iso8601 g_time_val_from_iso8601
g_time_val_to_iso8601 g_time_val_to_iso8601
<SUBSECTION>
GTimeSpec
<SUBSECTION> <SUBSECTION>
GDate GDate
GTime GTime

View File

@@ -134,6 +134,14 @@ length of the sleep.
@Returns: @Returns:
<!-- ##### STRUCT GTimeSpec ##### -->
<para>
</para>
@tv_sec:
@tv_nsec:
<!-- ##### STRUCT GDate ##### --> <!-- ##### STRUCT GDate ##### -->
<para> <para>
Represents a day between January 1, Year 1 and a few thousand years in Represents a day between January 1, Year 1 and a few thousand years in

View File

@@ -1812,6 +1812,15 @@ g_get_current_time (GTimeVal *result)
#endif #endif
} }
/**
* GTimeSpec:
*
* Represents a precise time, with seconds and nanoseconds. This is
* similar to POSIX <structname>struct timespec</structname>.
*
* Since: 2.28
**/
static void static void
g_main_dispatch_free (gpointer dispatch) g_main_dispatch_free (gpointer dispatch)
{ {

View File

@@ -33,6 +33,7 @@
#include <glibconfig.h> #include <glibconfig.h>
#include <glib/gmacros.h> #include <glib/gmacros.h>
#include <time.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -423,6 +424,14 @@ struct _GTimeVal
glong tv_usec; glong tv_usec;
}; };
typedef struct _GTimeSpec GTimeSpec;
struct _GTimeSpec
{
time_t tv_sec;
glong tv_nsec;
};
G_END_DECLS G_END_DECLS
/* We prefix variable declarations so they can /* We prefix variable declarations so they can