aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/timed/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/timed/write.c')
-rw-r--r--doc/examples/timed/write.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/examples/timed/write.c b/doc/examples/timed/write.c
index 250ba14..acd8c6f 100644
--- a/doc/examples/timed/write.c
+++ b/doc/examples/timed/write.c
@@ -15,13 +15,16 @@ int
main(int argc, char *argv[])
{
bus_t bus;
+ struct timespec timeout;
if (argc < 2) {
fprintf(stderr, "%s: USAGE: %s message\n", argv[0], argv[0]);
return 2;
}
sprintf(message, "0 %s", argv[1]);
t(bus_open(&bus, "/tmp/example-bus", BUS_WRONLY));
- t(bus_write(&bus, message, 0));
+ t(clock_gettime(CLOCK_MONOTONIC, &timeout));
+ timeout.tv_nsec += 100000000L;
+ t(bus_write_timed(&bus, message, &timeout, CLOCK_MONOTONIC));
bus_close(&bus);
return 0;