mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
gtypes: Deprecate GTimeVal in favour of guint64 or GDateTime
GTimeVal is subject to the year 2038 problem, since its `tv_sec` field is a `glong`, which is 32 bits on 32-bit platforms. Use `guint64` to represent microsecond-precision time since the Unix epoch; or use `GDateTime` for full date/time representation. Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1438
This commit is contained in:
parent
e357619d24
commit
e3f88f311f
@ -110,12 +110,14 @@ GLIB_AVAILABLE_IN_2_46
|
||||
void g_async_queue_push_front_unlocked (GAsyncQueue *queue,
|
||||
gpointer item);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop)
|
||||
gpointer g_async_queue_timed_pop (GAsyncQueue *queue,
|
||||
GTimeVal *end_time);
|
||||
GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop_unlocked)
|
||||
gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue,
|
||||
GTimeVal *end_time);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -123,6 +123,8 @@
|
||||
* removed from a future version of GLib. A consequence of using `glong` for
|
||||
* `tv_sec` is that on 32-bit systems `GTimeVal` is subject to the year 2038
|
||||
* problem.
|
||||
*
|
||||
* Deprecated: 2.62: Use #GDateTime or #guint64 instead.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -544,9 +544,11 @@ GLIB_AVAILABLE_IN_ALL
|
||||
void g_source_remove_child_source (GSource *source,
|
||||
GSource *child_source);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time)
|
||||
void g_source_get_current_time (GSource *source,
|
||||
GTimeVal *timeval);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
gint64 g_source_get_time (GSource *source);
|
||||
|
@ -546,13 +546,13 @@ union _GDoubleIEEE754
|
||||
#error unknown ENDIAN type
|
||||
#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
|
||||
|
||||
typedef struct _GTimeVal GTimeVal;
|
||||
typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
|
||||
|
||||
struct _GTimeVal
|
||||
{
|
||||
glong tv_sec;
|
||||
glong tv_usec;
|
||||
};
|
||||
} GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
|
||||
|
||||
typedef gint grefcount;
|
||||
typedef volatile gint gatomicrefcount;
|
||||
|
Loading…
Reference in New Issue
Block a user