diff --git a/include/villas/formats/msg_format.h b/include/villas/formats/msg_format.h index 029cf5210..ed73c9953 100644 --- a/include/villas/formats/msg_format.h +++ b/include/villas/formats/msg_format.h @@ -43,10 +43,9 @@ #define MSG_DATA_OFFSET(msg) ((char *) (msg) + offsetof(struct msg, data)) /** The timestamp of a message in struct timespec format */ -#define MSG_TS(msg) (struct timespec) { \ - .tv_sec = (msg)->ts.sec, \ - .tv_nsec = (msg)->ts.nsec \ -} +#define MSG_TS(msg, i) \ + i.tv_sec = (msg)->ts.sec; \ + i.tv_nsec = (msg)->ts.nsec; /** This message format is used by all clients * diff --git a/lib/formats/msg.cpp b/lib/formats/msg.cpp index 048c38bdb..73a452f72 100644 --- a/lib/formats/msg.cpp +++ b/lib/formats/msg.cpp @@ -84,7 +84,7 @@ int msg_to_sample(struct msg *msg, struct sample *smp, struct vlist *signals) smp->flags = SAMPLE_HAS_TS_ORIGIN | SAMPLE_HAS_SEQUENCE | SAMPLE_HAS_DATA; smp->length = MIN(msg->length, smp->capacity); smp->sequence = msg->sequence; - smp->ts.origin = MSG_TS(msg); + MSG_TS(msg, smp->ts.origin); for (unsigned i = 0; i < MIN(smp->length, vlist_length(signals)); i++) { struct signal *sig = (struct signal *) vlist_at(signals, i);