chiark / gitweb /
bus: rename sd_bus_get_realtime_timestamp() to sd_bus_get_realtime_usec()
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2014 10:25:39 +0000 (11:25 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2014 10:25:39 +0000 (11:25 +0100)
This brings the calls into similar style as the respective functions in
libsystemd-journal, and also is a bi shorter and more descriptive since
it clarifies the time unit used.

src/libsystemd/libsystemd.sym
src/libsystemd/sd-bus/bus-message.c
src/systemd/sd-bus.h

index bb3c1ab..951166a 100644 (file)
@@ -92,8 +92,8 @@ global:
         sd_bus_message_get_sender;
         sd_bus_message_get_error;
         sd_bus_message_get_errno;
-        sd_bus_message_get_monotonic_timestamp;
-        sd_bus_message_get_realtime_timestamp;
+        sd_bus_message_get_monotonic_usec;
+        sd_bus_message_get_realtime_usec;
         sd_bus_message_get_seqnum;
         sd_bus_message_get_creds;
         sd_bus_message_is_signal;
index 0c3913e..2c25b3f 100644 (file)
@@ -880,19 +880,23 @@ _public_ const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m) {
         return &m->error;
 }
 
-_public_ int sd_bus_message_get_monotonic_timestamp(sd_bus_message *m, uint64_t *usec) {
+_public_ int sd_bus_message_get_monotonic_usec(sd_bus_message *m, uint64_t *usec) {
         assert_return(m, -EINVAL);
         assert_return(usec, -EINVAL);
-        assert_return(m->monotonic > 0, -ENODATA);
+
+        if (m->monotonic <= 0)
+                return -ENODATA;
 
         *usec = m->monotonic;
         return 0;
 }
 
-_public_ int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *usec) {
+_public_ int sd_bus_message_get_realtime_usec(sd_bus_message *m, uint64_t *usec) {
         assert_return(m, -EINVAL);
         assert_return(usec, -EINVAL);
-        assert_return(m->realtime > 0, -ENODATA);
+
+        if (m->realtime <= 0)
+                return -ENODATA;
 
         *usec = m->realtime;
         return 0;
@@ -901,7 +905,9 @@ _public_ int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *
 _public_ int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t *seqnum) {
         assert_return(m, -EINVAL);
         assert_return(seqnum, -EINVAL);
-        assert_return(m->seqnum > 0, -ENODATA);
+
+        if (m->seqnum <= 0)
+                return -ENODATA;
 
         *seqnum = m->seqnum;
         return 0;
index 52627f6..4e6c321 100644 (file)
@@ -200,8 +200,8 @@ const char *sd_bus_message_get_sender(sd_bus_message *m);
 const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m);
 int sd_bus_message_get_errno(sd_bus_message *m);
 
-int sd_bus_message_get_monotonic_timestamp(sd_bus_message *m, uint64_t *usec);
-int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *usec);
+int sd_bus_message_get_monotonic_usec(sd_bus_message *m, uint64_t *usec);
+int sd_bus_message_get_realtime_usec(sd_bus_message *m, uint64_t *usec);
 int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t* seqnum);
 
 sd_bus_creds *sd_bus_message_get_creds(sd_bus_message *m); /* do not unref the result */