Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15020
b: refs/heads/master
c: 64123fd
h: refs/heads/master
v: v3
  • Loading branch information
Matt Helsley authored and Linus Torvalds committed Dec 12, 2005
1 parent 0c91dc7 commit 4e29d1d
Show file tree
Hide file tree
Showing 3 changed files with 24 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: 894ec8707ced240b96dc45944790fb35d9a6b03c
refs/heads/master: 64123fd42c7a1e4ebf6acd2399c98caddc7e0c26
1 change: 1 addition & 0 deletions trunk/include/linux/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ struct itimerval;
extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
extern int do_getitimer(int which, struct itimerval *value);
extern void getnstimeofday (struct timespec *tv);
extern void getnstimestamp(struct timespec *ts);

extern struct timespec timespec_trunc(struct timespec t, unsigned gran);

Expand Down
22 changes: 22 additions & 0 deletions trunk/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,28 @@ void getnstimeofday(struct timespec *tv)
EXPORT_SYMBOL_GPL(getnstimeofday);
#endif

void getnstimestamp(struct timespec *ts)
{
unsigned int seq;
struct timespec wall2mono;

/* synchronize with settimeofday() changes */
do {
seq = read_seqbegin(&xtime_lock);
getnstimeofday(ts);
wall2mono = wall_to_monotonic;
} while(unlikely(read_seqretry(&xtime_lock, seq)));

/* adjust to monotonicaly-increasing values */
ts->tv_sec += wall2mono.tv_sec;
ts->tv_nsec += wall2mono.tv_nsec;
while (unlikely(ts->tv_nsec >= NSEC_PER_SEC)) {
ts->tv_nsec -= NSEC_PER_SEC;
ts->tv_sec++;
}
}
EXPORT_SYMBOL_GPL(getnstimestamp);

#if (BITS_PER_LONG < 64)
u64 get_jiffies_64(void)
{
Expand Down

0 comments on commit 4e29d1d

Please sign in to comment.