[libgpiod v2][PATCH] API: suffix the time unit to get_timestamp functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to make it clear what unit we're using - add the _ns suffix
to timestamp getters for both the edge and info events.

Signed-off-by: Bartosz Golaszewski <brgl@xxxxxxxx>
---
 include/gpiod.h          | 4 ++--
 lib/edge-event.c         | 2 +-
 lib/info-event.c         | 2 +-
 tests/tests-edge-event.c | 4 ++--
 tests/tests-info-event.c | 6 +++---
 tools/gpiomon.c          | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/gpiod.h b/include/gpiod.h
index eaf6334..c605da8 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -493,7 +493,7 @@ int gpiod_info_event_get_event_type(struct gpiod_info_event *event);
  * @param event Line status watch event.
  * @return Timestamp in nanoseconds, read from the monotonic clock.
  */
-uint64_t gpiod_info_event_get_timestamp(struct gpiod_info_event *event);
+uint64_t gpiod_info_event_get_timestamp_ns(struct gpiod_info_event *event);
 
 /**
  * @brief Get the snapshot of line-info associated with the event.
@@ -1401,7 +1401,7 @@ int gpiod_edge_event_get_event_type(struct gpiod_edge_event *event);
  * @note The source clock for the timestamp depends on the event_clock
  *	 setting for the line.
  */
-uint64_t gpiod_edge_event_get_timestamp(struct gpiod_edge_event *event);
+uint64_t gpiod_edge_event_get_timestamp_ns(struct gpiod_edge_event *event);
 
 /**
  * @brief Get the offset of the line which triggered the event.
diff --git a/lib/edge-event.c b/lib/edge-event.c
index 661754e..48a0f95 100644
--- a/lib/edge-event.c
+++ b/lib/edge-event.c
@@ -55,7 +55,7 @@ GPIOD_API int gpiod_edge_event_get_event_type(struct gpiod_edge_event *event)
 }
 
 GPIOD_API uint64_t
-gpiod_edge_event_get_timestamp(struct gpiod_edge_event *event)
+gpiod_edge_event_get_timestamp_ns(struct gpiod_edge_event *event)
 {
 	return event->timestamp;
 }
diff --git a/lib/info-event.c b/lib/info-event.c
index 4abed57..73a3d6d 100644
--- a/lib/info-event.c
+++ b/lib/info-event.c
@@ -67,7 +67,7 @@ GPIOD_API int gpiod_info_event_get_event_type(struct gpiod_info_event *event)
 }
 
 GPIOD_API uint64_t
-gpiod_info_event_get_timestamp(struct gpiod_info_event *event)
+gpiod_info_event_get_timestamp_ns(struct gpiod_info_event *event)
 {
 	return event->timestamp;
 }
diff --git a/tests/tests-edge-event.c b/tests/tests-edge-event.c
index 28502a8..306383f 100644
--- a/tests/tests-edge-event.c
+++ b/tests/tests-edge-event.c
@@ -145,7 +145,7 @@ GPIOD_TEST_CASE(read_both_events)
 	g_assert_cmpint(gpiod_edge_event_get_event_type(event),
 			==, GPIOD_EDGE_EVENT_RISING_EDGE);
 	g_assert_cmpuint(gpiod_edge_event_get_line_offset(event), ==, 2);
-	ts_rising = gpiod_edge_event_get_timestamp(event);
+	ts_rising = gpiod_edge_event_get_timestamp_ns(event);
 
 	/* Second event. */
 
@@ -165,7 +165,7 @@ GPIOD_TEST_CASE(read_both_events)
 	g_assert_cmpint(gpiod_edge_event_get_event_type(event),
 			==, GPIOD_EDGE_EVENT_FALLING_EDGE);
 	g_assert_cmpuint(gpiod_edge_event_get_line_offset(event), ==, 2);
-	ts_falling = gpiod_edge_event_get_timestamp(event);
+	ts_falling = gpiod_edge_event_get_timestamp_ns(event);
 
 	g_thread_join(thread);
 
diff --git a/tests/tests-info-event.c b/tests/tests-info-event.c
index 0640d66..3f18784 100644
--- a/tests/tests-info-event.c
+++ b/tests/tests-info-event.c
@@ -184,9 +184,9 @@ GPIOD_TEST_CASE(request_reconfigure_release_events)
 
 	g_thread_join(thread);
 
-	request_ts = gpiod_info_event_get_timestamp(request_event);
-	reconfigure_ts = gpiod_info_event_get_timestamp(reconfigure_event);
-	release_ts = gpiod_info_event_get_timestamp(release_event);
+	request_ts = gpiod_info_event_get_timestamp_ns(request_event);
+	reconfigure_ts = gpiod_info_event_get_timestamp_ns(reconfigure_event);
+	release_ts = gpiod_info_event_get_timestamp_ns(release_event);
 
 	g_assert_cmpuint(request_ts, <, reconfigure_ts);
 	g_assert_cmpuint(reconfigure_ts, <, release_ts);
diff --git a/tools/gpiomon.c b/tools/gpiomon.c
index 4769e62..f6a0dba 100644
--- a/tools/gpiomon.c
+++ b/tools/gpiomon.c
@@ -299,7 +299,7 @@ int main(int argc, char **argv)
 
 			handle_event(gpiod_edge_event_get_line_offset(event),
 				     gpiod_edge_event_get_event_type(event),
-				     gpiod_edge_event_get_timestamp(event),
+				     gpiod_edge_event_get_timestamp_ns(event),
 				     &ctx);
 
 			events_done++;
-- 
2.30.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux