aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2019-10-21 15:11:28 -0700
committerArve Hjønnevåg <arve@android.com>2019-10-25 16:23:33 -0700
commit3c1ceea574ac5059e4668199e2d29ba56d40d044 (patch)
tree58c22f53057861c0066934fd2410bf070e3780fc /lib
parentf2b002678c0074b6738d40f62b899ba32e0cfdb3 (diff)
downloadcommon-3c1ceea574ac5059e4668199e2d29ba56d40d044.tar.gz
[kernel][timer] Replace lk_bigtime_t with lk_time_ns_t
Replace lk_bigtime_t with lk_time_ns_t in preparation for supporting higher resolution timers. lk_bigtime_t was 64 bits, but stored micro seconds. Storing nano seconds gives us hundreds of years range and most hardware has timer ticks shorter than the 1us we could return before. Bug: 131099439 Change-Id: I4b9bda393c3a2a0eb81798a7e935b8701d099f8f
Diffstat (limited to 'lib')
-rw-r--r--lib/debug/debug.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/debug/debug.c b/lib/debug/debug.c
index ee68053f..847074d5 100644
--- a/lib/debug/debug.c
+++ b/lib/debug/debug.c
@@ -34,9 +34,10 @@
void spin(uint32_t usecs)
{
- lk_bigtime_t start = current_time_hires();
+ lk_time_ns_t nsecs = usecs * 1000ULL;
+ lk_time_ns_t start = current_time_ns();
- while ((current_time_hires() - start) < usecs)
+ while ((current_time_ns() - start) < nsecs)
;
}