[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/32] qga: replace deprecated g_get_current_time()
From: |
marcandre . lureau |
Subject: |
[PATCH 12/32] qga: replace deprecated g_get_current_time() |
Date: |
Wed, 23 Mar 2022 19:57:23 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
According to GLib API:
g_get_current_time has been deprecated since version 2.62 and should not
be used in newly-written code. GTimeVal is not year-2038-safe. Use
g_get_real_time() instead.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
qga/main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/qga/main.c b/qga/main.c
index b9dd19918e47..1deb0ee2fbfe 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -314,7 +314,6 @@ static void ga_log(const gchar *domain, GLogLevelFlags
level,
const gchar *msg, gpointer opaque)
{
GAState *s = opaque;
- GTimeVal time;
const char *level_str = ga_log_level_str(level);
if (!ga_logging_enabled(s)) {
@@ -329,9 +328,11 @@ static void ga_log(const gchar *domain, GLogLevelFlags
level,
#else
if (level & s->log_level) {
#endif
- g_get_current_time(&time);
+ gint64 t = g_get_real_time();
fprintf(s->log_file,
- "%lu.%lu: %s: %s\n", time.tv_sec, time.tv_usec, level_str,
msg);
+ "%" G_GINT64_FORMAT ".%" G_GINT64_FORMAT
+ ": %s: %s\n", t / G_USEC_PER_SEC, t % G_USEC_PER_SEC,
+ level_str, msg);
fflush(s->log_file);
}
}
--
2.35.1.273.ge6ebfd0e8cbb
- Re: [PATCH 06/32] Replace config-time define HOST_WORDS_BIGENDIAN, (continued)
- [PATCH 08/32] osdep: poison {HOST,TARGET}_WORDS_BIGENDIAN, marcandre . lureau, 2022/03/23
- [PATCH 07/32] Replace TARGET_WORDS_BIGENDIAN, marcandre . lureau, 2022/03/23
- [PATCH 09/32] include/qapi: add g_autoptr support for qobject types, marcandre . lureau, 2022/03/23
- [PATCH 10/32] tests: replace free_all() usage with g_auto, marcandre . lureau, 2022/03/23
- [PATCH 12/32] qga: replace deprecated g_get_current_time(),
marcandre . lureau <=
- [PATCH 11/32] Replace qemu_real_host_page variables with inlined functions, marcandre . lureau, 2022/03/23
- [PATCH 14/32] util: rename qemu-error.c to match its header name, marcandre . lureau, 2022/03/23
- [PATCH 13/32] error-report: replace deprecated g_get_current_time() with glib >= 2.62, marcandre . lureau, 2022/03/23
- [PATCH 15/32] error-report: use error_printf() for program prefix, marcandre . lureau, 2022/03/23
- [PATCH 16/32] include: move TFR to osdep.h, marcandre . lureau, 2022/03/23
- [PATCH 18/32] include: move qemu_pipe() to osdep.h, marcandre . lureau, 2022/03/23
- [PATCH 17/32] include: move qemu_write_full() declaration to osdep.h, marcandre . lureau, 2022/03/23
- [PATCH 19/32] include: move coroutine IO functions to coroutine.h, marcandre . lureau, 2022/03/23