[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/53] qga: replace deprecated g_get_current_time()
From: |
Paolo Bonzini |
Subject: |
[PULL 17/53] qga: replace deprecated g_get_current_time() |
Date: |
Tue, 19 Apr 2022 07:50:33 +0200 |
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>
Message-Id: <20220323155743.1585078-13-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qga/main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/qga/main.c b/qga/main.c
index b9dd19918e..1deb0ee2fb 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
- [PULL 40/53] thread-posix: remove the posix semaphore support, (continued)
- [PULL 40/53] thread-posix: remove the posix semaphore support, Paolo Bonzini, 2022/04/19
- [PULL 44/53] hyperv: SControl is optional to enable SynIc, Paolo Bonzini, 2022/04/19
- [PULL 52/53] target/i386: do not access beyond the low 128 bits of SSE registers, Paolo Bonzini, 2022/04/19
- [PULL 30/53] include: move qemu_get_vm_name() to sysemu.h, Paolo Bonzini, 2022/04/19
- [PULL 05/53] oslib: drop qemu_gettimeofday(), Paolo Bonzini, 2022/04/19
- [PULL 03/53] qga: replace qemu_gettimeofday() with g_get_real_time(), Paolo Bonzini, 2022/04/19
- [PULL 04/53] Replace qemu_gettimeofday() with g_get_real_time(), Paolo Bonzini, 2022/04/19
- [PULL 13/53] osdep: poison {HOST,TARGET}_WORDS_BIGENDIAN, Paolo Bonzini, 2022/04/19
- [PULL 09/53] meson: remove test-qdev-global-props dependency on testqapi, Paolo Bonzini, 2022/04/19
- [PULL 10/53] char: move qemu_openpty_raw from util/ to char/, Paolo Bonzini, 2022/04/19
- [PULL 17/53] qga: replace deprecated g_get_current_time(),
Paolo Bonzini <=
- [PULL 12/53] Replace TARGET_WORDS_BIGENDIAN, Paolo Bonzini, 2022/04/19
- [PULL 02/53] qtest: replace gettimeofday with GTimer, Paolo Bonzini, 2022/04/19
- [PULL 15/53] tests: replace free_all() usage with g_auto, Paolo Bonzini, 2022/04/19
- [PULL 31/53] include: move os_*() to os-foo.h, Paolo Bonzini, 2022/04/19
- [PULL 33/53] Move CPU softfloat unions to cpu-float.h, Paolo Bonzini, 2022/04/19
- [PULL 34/53] Move fcntl_setfl() to oslib-posix, Paolo Bonzini, 2022/04/19
- [PULL 35/53] qga: remove explicit environ argument from exec/spawn, Paolo Bonzini, 2022/04/19
- [PULL 28/53] include: move target page bits declaration to page-vary.h, Paolo Bonzini, 2022/04/19
- [PULL 29/53] include: move progress API to qemu-progress.h, Paolo Bonzini, 2022/04/19
- [PULL 45/53] hyperv: Add definitions for syndbg, Paolo Bonzini, 2022/04/19