Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54332
b: refs/heads/master
c: b7ec15b
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed May 7, 2007
1 parent 7274eaa commit 5b1c07f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 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: 83ff7df5f1c1c44efd84d7341211aa0138fd9504
refs/heads/master: b7ec15bd004f4524bf091f851348da2ccb519e4f
14 changes: 12 additions & 2 deletions trunk/arch/um/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ unsigned long long sched_clock(void)
return (unsigned long long)jiffies_64 * (1000000000 / HZ);
}

static unsigned long long prev_nsecs[NR_CPUS];
#ifdef CONFIG_UML_REAL_TIME_CLOCK
static unsigned long long prev_nsecs[NR_CPUS];
static long long delta[NR_CPUS]; /* Deviation per interval */
#endif

Expand Down Expand Up @@ -94,7 +94,12 @@ irqreturn_t um_timer(int irq, void *dev)

do_timer(1);

#ifdef CONFIG_UML_REAL_TIME_CLOCK
nsecs = get_time();
#else
nsecs = (unsigned long long) xtime.tv_sec * BILLION + xtime.tv_nsec +
BILLION / HZ;
#endif
xtime.tv_sec = nsecs / NSEC_PER_SEC;
xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;

Expand Down Expand Up @@ -127,13 +132,18 @@ void time_init(void)
nsecs = os_nsecs();
set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
-nsecs % BILLION);
set_normalized_timespec(&xtime, nsecs / BILLION, nsecs % BILLION);
late_time_init = register_timer;
}

void do_gettimeofday(struct timeval *tv)
{
#ifdef CONFIG_UML_REAL_TIME_CLOCK
unsigned long long nsecs = get_time();

#else
unsigned long long nsecs = (unsigned long long) xtime.tv_sec * BILLION +
xtime.tv_nsec;
#endif
tv->tv_sec = nsecs / NSEC_PER_SEC;
/* Careful about calculations here - this was originally done as
* (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC
Expand Down

0 comments on commit 5b1c07f

Please sign in to comment.