Fix comments. add convenience macro

This commit is contained in:
Nils O. Selåsdal
2013-03-07 21:38:07 +01:00
parent b80c2f633f
commit 40f34b2bcd
+19 -9
View File
@@ -23,6 +23,12 @@ struct UCoreClock {
void (*now)(struct UCoreClock *clock, struct timeval *tv);
};
/** Convenience macro for geting the time from a UCoreClock
* @param uclock pointer to the clock
* @param tv struct timeval pointer that will be filled in.
*/
#define UCORE_CLOCK_NOW(uclock, tv) (uclock)->now((uclock), (tv))
/** A cached clock where clock.now() returns
* the cached value. The cache is updated
@@ -34,7 +40,7 @@ struct UCoreCachedClock {
struct UCoreClock clock;
/** The underlying real clock*/
struct UCoreClock *real_clock;
/** cached value */
/** Cached value */
struct timeval cache;
};
@@ -45,7 +51,6 @@ struct UCoreCachedClock {
struct UCoreSettableClock {
/** The clock*/
struct UCoreClock clock;
/** The underlying real clock*/
/** Current value */
struct timeval now;
};
@@ -62,9 +67,13 @@ extern struct UCoreClock uc_timeofday_clock;
extern struct UCoreClock uc_time_clock;
/**
* Initialize a cached clock where now() calls time().
* This clock will this just have seconds resolution.
* @param clock clock to initialize
* Initialize a cached clock whose now() is a cached
* value of the real_clock.
*
* @param uclock clock to initialize
* @param real_clock underlying clock that updates
* the cache.
*
*/
void uc_cached_clock_init(struct UCoreCachedClock *uclock,
struct UCoreClock *real_clock);
@@ -75,9 +84,10 @@ void uc_cached_clock_update(struct UCoreCachedClock *uclock);
/**
* Initialize a user settable where now() calls time().
* This clock will this just have seconds resolution.
* @param clock clock to initialize
* Initialize a user settable clock, where now()
* returns the user set time.
*
* @param clock uclock to initialize
*/
void uc_settable_clock_init(struct UCoreSettableClock *uclock);
@@ -88,7 +98,7 @@ void uc_settable_clock_set_tv(struct UCoreSettableClock *uclock,
const struct timeval *tv);
/**
* Set the new timeval this clock will return
* Set the new time this clock will return
* Convenience function that takes seconds/microseconds as arguments
* instead of a struct timeval.
**/