aboutsummaryrefslogtreecommitdiff
path: root/kernel/time.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-12-14 02:59:50 -0500
committerLen Brown <len.brown@intel.com>2005-12-14 02:59:50 -0500
commitd3e4cefc86ce1aefc0e9aebdc56308cb4bd51997 (patch)
treef4418610996064cab63600ca093de65356dcdfde /kernel/time.c
parent927fe18397b3b1194a5b26b1d388d97e391e5fd2 (diff)
parentacd9b7b4e08a3f0f48afa922d8e371414cf2d3b2 (diff)
Auto-update from upstream
Diffstat (limited to 'kernel/time.c')
-rw-r--r--kernel/time.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/time.c b/kernel/time.c
index 245d595a13c..b94bfa8c03e 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -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)
{