Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146694
b: refs/heads/master
c: 7d27558
h: refs/heads/master
v: v3
  • Loading branch information
john stultz authored and Thomas Gleixner committed May 2, 2009
1 parent 4d41c72 commit 6fc036d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a25cbd045a2ffc42787d4dbcbb9c7118f5f42732
refs/heads/master: 7d27558c4138ac6b3684dea35c2f4379b940a7dd
15 changes: 15 additions & 0 deletions trunk/include/linux/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ struct timespec current_kernel_time(void);
#define CURRENT_TIME (current_kernel_time())
#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })

/* Some architectures do not supply their own clocksource.
* This is mainly the case in architectures that get their
* inter-tick times by reading the counter on their interval
* timer. Since these timers wrap every tick, they're not really
* useful as clocksources. Wrapping them to act like one is possible
* but not very efficient. So we provide a callout these arches
* can implement for use with the jiffies clocksource to provide
* finer then tick granular time.
*/
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
extern u32 arch_gettimeoffset(void);
#else
static inline u32 arch_gettimeoffset(void) { return 0; }
#endif

extern void do_gettimeofday(struct timeval *tv);
extern int do_settimeofday(struct timespec *tv);
extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
Expand Down
7 changes: 7 additions & 0 deletions trunk/kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ static void clocksource_forward_now(void)
clock->cycle_last = cycle_now;

nsec = cyc2ns(clock, cycle_delta);

/* If arch requires, add in gettimeoffset() */
nsec += arch_gettimeoffset();

timespec_add_ns(&xtime, nsec);

nsec = ((s64)cycle_delta * clock->mult_orig) >> clock->shift;
Expand Down Expand Up @@ -111,6 +115,9 @@ void getnstimeofday(struct timespec *ts)
/* convert to nanoseconds: */
nsecs = cyc2ns(clock, cycle_delta);

/* If arch requires, add in gettimeoffset() */
nsecs += arch_gettimeoffset();

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

timespec_add_ns(ts, nsecs);
Expand Down

0 comments on commit 6fc036d

Please sign in to comment.