about summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/client.c b/client.c
index de3f087..3dce5e9 100644
--- a/client.c
+++ b/client.c
@@ -19,6 +19,7 @@
 #include <regex.h>
 #include <stdarg.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -394,7 +395,7 @@ static Filter *Filters[] = {
 };
 
 void clientConsume(struct Client *client) {
-	time_t time;
+	struct timeval time;
 	const char *line = ringPeek(&time, client->consumer);
 	if (!line) return;
 
@@ -409,10 +410,13 @@ void clientConsume(struct Client *client) {
 	}
 
 	if (client->caps & CapServerTime) {
-		char ts[sizeof("YYYY-MM-DDThh:mm:ss.sssZ")];
-		struct tm *tm = gmtime(&time);
-		strftime(ts, sizeof(ts), "%FT%T.000Z", tm);
-		clientFormat(client, "@time=%s %s\r\n", ts, line);
+		char ts[sizeof("YYYY-MM-DDThh:mm:ss")];
+		struct tm *tm = gmtime(&time.tv_sec);
+		strftime(ts, sizeof(ts), "%FT%T", tm);
+		clientFormat(
+			client, "@time=%s.%03jdZ %s\r\n",
+			ts, (intmax_t)(time.tv_usec / 1000), line
+		);
 	} else {
 		clientFormat(client, "%s\r\n", line);
 	}
w=1'>Enable -Wmissing-prototypesJune McEnroe 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe 2022-02-18Implement new line editing "library"June McEnroe 2022-02-18Simplify cursor positioning in inputJune McEnroe 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe