1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

add more const keywords

This commit is contained in:
Steffen Vogel 2017-05-08 00:46:19 +02:00
parent 6bbeae45ef
commit 19df0d196d
2 changed files with 10 additions and 10 deletions

View file

@ -47,22 +47,22 @@ uint64_t timerfd_wait(int fd);
* @retval 0 An error occured. Maybe the timer was stopped.
* @retval >0 The nummer of runs this timer already fired.
*/
uint64_t timerfd_wait_until(int fd, struct timespec *until);
uint64_t timerfd_wait_until(int fd, const struct timespec *until);
/** Get delta between two timespec structs */
struct timespec time_diff(struct timespec *start, struct timespec *end);
struct timespec time_diff(const struct timespec *start, const struct timespec *end);
/** Get sum of two timespec structs */
struct timespec time_add(struct timespec *start, struct timespec *end);
struct timespec time_add(const struct timespec *start, const struct timespec *end);
/** Return current time as a struct timespec. */
struct timespec time_now();
/** Return the diffrence off two timestamps as double value in seconds. */
double time_delta(struct timespec *start, struct timespec *end);
double time_delta(const struct timespec *start, const struct timespec *end);
/** Convert timespec to double value representing seconds */
double time_to_double(struct timespec *ts);
double time_to_double(const struct timespec *ts);
/** Convert double containing seconds after 1970 to timespec. */
struct timespec time_from_double(double secs);

View file

@ -54,7 +54,7 @@ uint64_t timerfd_wait(int fd)
return read(fd, &runs, sizeof(runs)) < 0 ? 0 : runs;
}
uint64_t timerfd_wait_until(int fd, struct timespec *until)
uint64_t timerfd_wait_until(int fd, const struct timespec *until)
{
int ret;
struct itimerspec its = {
@ -78,7 +78,7 @@ struct timespec time_now()
return ts;
}
struct timespec time_add(struct timespec *start, struct timespec *end)
struct timespec time_add(const struct timespec *start, const struct timespec *end)
{
struct timespec sum = {
.tv_sec = end->tv_sec + start->tv_sec,
@ -93,7 +93,7 @@ struct timespec time_add(struct timespec *start, struct timespec *end)
return sum;
}
struct timespec time_diff(struct timespec *start, struct timespec *end)
struct timespec time_diff(const struct timespec *start, const struct timespec *end)
{
struct timespec diff = {
.tv_sec = end->tv_sec - start->tv_sec,
@ -118,12 +118,12 @@ struct timespec time_from_double(double secs)
return ts;
}
double time_to_double(struct timespec *ts)
double time_to_double(const struct timespec *ts)
{
return ts->tv_sec + ts->tv_nsec * 1e-9;
}
double time_delta(struct timespec *start, struct timespec *end)
double time_delta(const struct timespec *start, const struct timespec *end)
{
struct timespec diff = time_diff(start, end);