@@ -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.
@@ -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;
}
@@ -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;
}
@@ -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);
@@ -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);
@@ -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++;
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@bgdev.pl> --- 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(-)