From 474de83b4dab1668b83c133435e5896ee002b6af Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 14 Nov 2019 17:10:28 -0500 Subject: Use struct timeval for sub-second precision --- client.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index de3f087..3dce5e9 100644 --- a/client.c +++ b/client.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -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); } -- cgit 1.4.1 /src/diff/doc/zlib/crc32_combine.3?id=e886fbb30f1b157aa4daba9cda6ca13186a760d8&follow=1'>diff
Commit message (Expand)Author
2021-01-12Style causal.agency like bin HTMLJune McEnroe
2021-01-12Avoid matching tag text inside HTML elementsJune McEnroe
2021-01-12Use hilex for up -hJune McEnroe
2021-01-12Use hilex for bin HTMLJune McEnroe
2021-01-12Don't output a pre in hilex by defaultJune McEnroe
2021-01-12Move hilex out of hilex directoryJune McEnroe
2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe
2021-01-12Remove hacky tagging from hilexJune McEnroe
2021-01-12Add htagml -iJune McEnroe
2021-01-12Render tag index in HTMLJune McEnroe
2021-01-12Add htagml -xJune McEnroe
2021-01-12Prevent matching the same tag twiceJune McEnroe
2021-01-12Process htagml file line by lineJune McEnroe
2021-01-12Split fields by tab onlyJune McEnroe
2021-01-12List both Makefile and html.sh under README.7June McEnroe
2021-01-12Add htagml exampleJune McEnroe
2021-01-12Use mandoc and htagml for bin htmlJune McEnroe
2021-01-12Add htagmlJune McEnroe
2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe
2021-01-11Publish "Using vi"June McEnroe
2021-01-11Enable diff.colorMovedJune McEnroe
2021-01-10Set less search case-insensitiveJune McEnroe
2021-01-10Set EXINITJune McEnroe
2021-01-09Add c -t flag to print expression typeJune McEnroe
2021-01-05Update taglineJune McEnroe