Skip to contentSkip to conversation

Block patches

GIT PULL Applied Stefan Hajnoczi 1 participant 3 messages Sep 22, 2022 – Sep 27, 2022

lore
Share & tools
lore
#0 lore raw

The following changes since commit 6338c30111d596d955e6bc933a82184a0b910c43:

Merge tag 'm68k-for-7.2-pull-request' of https://github.com/vivier/qemu-m68k into staging (2022-09-21 13:12:36 -0400)

are available in the Git repository at:

https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to f16d15c9276bd8f501f861c39cbd4adc812d0c1d:

virtiofsd: use g_date_time_get_microsecond to get subsecond (2022-09-22 13:13:47 -0400)

----------------------------------------------------------------
Pull request

----------------------------------------------------------------

Yusuke Okada (1):
virtiofsd: use g_date_time_get_microsecond to get subsecond

 tools/virtiofsd/passthrough_ll.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.37.3
#1 lore raw

[PULL 1/1] virtiofsd: use g_date_time_get_microsecond to get subsecond

From: Yusuke Okada <[email protected]>

The "%f" specifier in g_date_time_format() is only available in glib 2.65.2 or later. If combined with older glib, the function returns null and the timestamp displayed as "(null)".

For backward compatibility, g_date_time_get_microsecond should be used to retrieve subsecond.

In this patch the g_date_time_format() leaves subsecond field as "%06d" and let next snprintf to format with g_date_time_get_microsecond.

Message-id: [email protected]

---
 tools/virtiofsd/passthrough_ll.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/virtiofsd/passthrough_ll.c +5 -2
index 371a7bead6..20f0f41f99 100644
@@ -4185,6 +4185,7 @@ static void setup_nofile_rlimit(unsigned long rlimit_nofile)
 static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
 {
     g_autofree char *localfmt = NULL;
+    char buf[64];
 
     if (current_log_level < level) {
         return;
@@ -4197,9 +4198,11 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
                                        fmt);
         } else {
             g_autoptr(GDateTime) now = g_date_time_new_now_utc();
-            g_autofree char *nowstr = g_date_time_format(now, "%Y-%m-%d %H:%M:%S.%f%z");
+            g_autofree char *nowstr = g_date_time_format(now,
+                                       "%Y-%m-%d %H:%M:%S.%%06d%z");
+            snprintf(buf, 64, nowstr, g_date_time_get_microsecond(now));
             localfmt = g_strdup_printf("[%s] [ID: %08ld] %s",
-                                       nowstr, syscall(__NR_gettid), fmt);
+                                       buf, syscall(__NR_gettid), fmt);
         }
         fmt = localfmt;
     }
Signature · 1 line
2.37.3