duration_elapsed and duration_kbps will not modify the struct duration
passed as function argument, hence it should be declared const.
Change-Id: I459c396952c78e907257e2c2f2c630abde92aaa8
Signed-off-by: Alexander Kurz <akurz@blala.de>
Reviewed-on: http://openocd.zylin.com/3232
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
return retval;
}
-float duration_elapsed(struct duration *duration)
+float duration_elapsed(const struct duration *duration)
{
float t = duration->elapsed.tv_sec;
t += (float)duration->elapsed.tv_usec / 1000000.0;
return t;
}
-float duration_kbps(struct duration *duration, size_t count)
+float duration_kbps(const struct duration *duration, size_t count)
{
return count / (1024.0 * duration_elapsed(duration));
}
int duration_measure(struct duration *duration);
/** @returns Elapsed time in seconds. */
-float duration_elapsed(struct duration *duration);
+float duration_elapsed(const struct duration *duration);
/** @returns KB/sec for the elapsed @a duration and @a count bytes. */
-float duration_kbps(struct duration *duration, size_t count);
+float duration_kbps(const struct duration *duration, size_t count);
#endif /* TIME_SUPPORT_H */