13
* Add the specified number of microseconds to the time stored in \p tv
14
* @param[in,out] tv - timestamp
15
* @param[in] timeout - number of microseconds to add
16
* @return - error code or 0 for correctness
11
18
int pcilib_add_timeout(struct timeval *tv, pcilib_timeout_t timeout);
21
* Computes the deadline by adding the specified number of microseconds to the current timestamp
22
* @param[out] tv - the deadline
23
* @param[in] timeout - number of microseconds to add
24
* @return - error code or 0 for correctness
12
26
int pcilib_calc_deadline(struct timeval *tv, pcilib_timeout_t timeout);
13
int pcilib_check_deadline(struct timeval *tve, pcilib_timeout_t timeout);
14
pcilib_timeout_t pcilib_calc_time_to_deadline(struct timeval *tve);
29
* Check if we are within \p timeout microseconds before the specified deadline or already past it
30
* @param[in] tv - the deadline
31
* @param[in] timeout - maximum number of microseconds before deadline
32
* @return - 1 if we are within \p timeout microseconds before deadline or past it, 0 - otherwise
34
int pcilib_check_deadline(struct timeval *tv, pcilib_timeout_t timeout);
37
* Compute the remaining time to deadline
38
* @param[in] tv - the deadline
39
* @return - number of microseconds until deadline or 0 if we are already past it
41
pcilib_timeout_t pcilib_calc_time_to_deadline(struct timeval *tv);
44
* Executes sleep until the specified deadline
45
* Real-time capabilities are not used. TThe sleep could wake slightly after the specified deadline.
46
* @param[in] tv - the deadline
47
* @return - error code or 0 for correctness
15
49
int pcilib_sleep_until_deadline(struct timeval *tv);
52
* Computes the number of microseconds between 2 timestamps.
53
* This function expects that \p tve is after \p tvs.
54
* @param[in] tve - the end of the time interval
55
* @param[in] tvs - the beginning of the time interval
56
* @return - number of microseconds between two timestamps
58
pcilib_timeout_t pcilib_timediff(struct timeval *tve, struct timeval *tvs);
61
* Compares two timestamps
62
* @param[in] tv1 - the first timestamp
63
* @param[in] tv2 - the second timestamp
64
* @return - 0 if timestamps are equal, 1 if the first timestamp is after the second, or -1 if the second is after the first.
16
66
int pcilib_timecmp(struct timeval *tv1, struct timeval *tv2);
17
pcilib_timeout_t pcilib_timediff(struct timeval *tve, struct timeval *tvs);