xC/xP: pass timestamps with millisecond precision
Future-proofing the protocol.
This commit is contained in:
parent
d2af6cf64c
commit
31e9c6d2d5
2
xC-proto
2
xC-proto
|
@ -71,7 +71,7 @@ struct EventMessage {
|
||||||
PART,
|
PART,
|
||||||
ACTION,
|
ACTION,
|
||||||
} rendition;
|
} rendition;
|
||||||
// Unix timestamp in seconds.
|
// Unix timestamp in milliseconds.
|
||||||
u64 when;
|
u64 when;
|
||||||
// Broken-up text, with in-band formatting.
|
// Broken-up text, with in-band formatting.
|
||||||
union ItemData switch (enum Item {
|
union ItemData switch (enum Item {
|
||||||
|
|
2
xC.c
2
xC.c
|
@ -3105,7 +3105,7 @@ relay_prepare_buffer_line (struct app_context *ctx, struct buffer *buffer,
|
||||||
e->is_unimportant = !!(line->flags & BUFFER_LINE_UNIMPORTANT);
|
e->is_unimportant = !!(line->flags & BUFFER_LINE_UNIMPORTANT);
|
||||||
e->is_highlight = !!(line->flags & BUFFER_LINE_HIGHLIGHT);
|
e->is_highlight = !!(line->flags & BUFFER_LINE_HIGHLIGHT);
|
||||||
e->rendition = 1 + line->r;
|
e->rendition = 1 + line->r;
|
||||||
e->when = line->when;
|
e->when = line->when * 1000;
|
||||||
|
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
for (size_t i = 0; line->items[i].type; i++)
|
for (size_t i = 0; line->items[i].type; i++)
|
||||||
|
|
|
@ -196,7 +196,7 @@ let Buffer = {
|
||||||
|
|
||||||
let lastDateMark = undefined
|
let lastDateMark = undefined
|
||||||
b.lines.forEach(line => {
|
b.lines.forEach(line => {
|
||||||
let date = new Date(line.when * 1000)
|
let date = new Date(line.when)
|
||||||
let dateMark = date.toLocaleDateString()
|
let dateMark = date.toLocaleDateString()
|
||||||
if (dateMark !== lastDateMark) {
|
if (dateMark !== lastDateMark) {
|
||||||
lines.push(m('.date', {}, dateMark))
|
lines.push(m('.date', {}, dateMark))
|
||||||
|
|
Loading…
Reference in New Issue