Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163052
b: refs/heads/master
c: a40f262
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner committed Jul 7, 2009
1 parent 989b81e commit b792029
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 63 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 951ed4d36b77ba9fe1ea08fc3c59d8bb6c9bda32
refs/heads/master: a40f262cc21fbfd781bbddcc40b16b83a75f5f34
60 changes: 0 additions & 60 deletions trunk/kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,6 @@

#include <asm/uaccess.h>

#ifndef CONFIG_GENERIC_TIME
/**
* ktime_get - get the monotonic time in ktime_t format
*
* returns the time in ktime_t format
*/
ktime_t ktime_get(void)
{
struct timespec now;

ktime_get_ts(&now);

return timespec_to_ktime(now);
}
EXPORT_SYMBOL_GPL(ktime_get);
#endif

/**
* ktime_get_real - get the real (wall-) time in ktime_t format
*
* returns the time in ktime_t format
*/
ktime_t ktime_get_real(void)
{
struct timespec now;

getnstimeofday(&now);

return timespec_to_ktime(now);
}

EXPORT_SYMBOL_GPL(ktime_get_real);

/*
* The timer bases:
*
Expand Down Expand Up @@ -108,33 +75,6 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
}
};

#ifndef CONFIG_GENERIC_TIME
/**
* ktime_get_ts - get the monotonic clock in timespec format
* @ts: pointer to timespec variable
*
* The function calculates the monotonic clock from the realtime
* clock and the wall_to_monotonic offset and stores the result
* in normalized timespec format in the variable pointed to by @ts.
*/
void ktime_get_ts(struct timespec *ts)
{
struct timespec tomono;
unsigned long seq;

do {
seq = read_seqbegin(&xtime_lock);
getnstimeofday(ts);
tomono = wall_to_monotonic;

} while (read_seqretry(&xtime_lock, seq));

set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
ts->tv_nsec + tomono.tv_nsec);
}
EXPORT_SYMBOL_GPL(ktime_get_ts);
#endif

/*
* Get the coarse grained time at the softirq based on xtime and
* wall_to_monotonic.
Expand Down
59 changes: 57 additions & 2 deletions trunk/kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,65 @@ static void change_clocksource(void)
clock->name);
*/
}
#else
#else /* GENERIC_TIME */
static inline void clocksource_forward_now(void) { }
static inline void change_clocksource(void) { }
#endif

/**
* ktime_get - get the monotonic time in ktime_t format
*
* returns the time in ktime_t format
*/
ktime_t ktime_get(void)
{
struct timespec now;

ktime_get_ts(&now);

return timespec_to_ktime(now);
}
EXPORT_SYMBOL_GPL(ktime_get);

/**
* ktime_get_ts - get the monotonic clock in timespec format
* @ts: pointer to timespec variable
*
* The function calculates the monotonic clock from the realtime
* clock and the wall_to_monotonic offset and stores the result
* in normalized timespec format in the variable pointed to by @ts.
*/
void ktime_get_ts(struct timespec *ts)
{
struct timespec tomono;
unsigned long seq;

do {
seq = read_seqbegin(&xtime_lock);
getnstimeofday(ts);
tomono = wall_to_monotonic;

} while (read_seqretry(&xtime_lock, seq));

set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
ts->tv_nsec + tomono.tv_nsec);
}
EXPORT_SYMBOL_GPL(ktime_get_ts);
#endif /* !GENERIC_TIME */

/**
* ktime_get_real - get the real (wall-) time in ktime_t format
*
* returns the time in ktime_t format
*/
ktime_t ktime_get_real(void)
{
struct timespec now;

getnstimeofday(&now);

return timespec_to_ktime(now);
}
EXPORT_SYMBOL_GPL(ktime_get_real);

/**
* getrawmonotonic - Returns the raw monotonic time in a timespec
Expand Down

0 comments on commit b792029

Please sign in to comment.