aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/timed/write.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-05-17 14:49:22 +0200
committerMattias Andrée <maandree@operamail.com>2015-05-17 14:49:22 +0200
commit5411b208af6b45cd45b00f45bc135b65a7ae899f (patch)
treebe4d56e8b7a3efb63018d702f327a4b7c7662fad /doc/examples/timed/write.c
parentm (diff)
downloadbus-5411b208af6b45cd45b00f45bc135b65a7ae899f.tar.gz
bus-5411b208af6b45cd45b00f45bc135b65a7ae899f.tar.bz2
bus-5411b208af6b45cd45b00f45bc135b65a7ae899f.tar.xz
timed write example3.1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-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;