mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
23 lines
553 B
C
23 lines
553 B
C
// SPDX-License-Identifier: MIT
|
|
#include <linux/jiffies.h>
|
|
#include <linux/time64.h>
|
|
#include <linux/ktime.h>
|
|
#include "clock_adapter.h"
|
|
u64 nv_rs_clock_monotonic_ns(void)
|
|
{
|
|
return ktime_get_ns();
|
|
}
|
|
u64 nv_rs_clock_tick_resolution_ns(void)
|
|
{
|
|
return (u64)jiffies_to_usecs(1) * NSEC_PER_USEC;
|
|
}
|
|
void nv_rs_clock_system_time(u32 *seconds, u32 *microseconds)
|
|
{
|
|
struct timespec64 now;
|
|
ktime_get_real_ts64(&now);
|
|
if (seconds)
|
|
*seconds = (u32)now.tv_sec;
|
|
if (microseconds)
|
|
*microseconds = now.tv_nsec / NSEC_PER_USEC;
|
|
}
|