Files
nvdriver/kernel-open/nvidia/clock_adapter.c
Eric Hartford 33ff608a88 Add MIT LICENSE and unify repository SPDX/Cargo/module licensing
- Add root LICENSE (MIT License, Copyright (c) 2026 QuixiAI / Eric Hartford).
- Set license = "MIT" in workspace Cargo.toml and member crates (zero non-MIT dependencies).
- Update all kernel-open/ and tests/vm/ SPDX headers to MIT and EXPORT_SYMBOL_GPL -> EXPORT_SYMBOL.
- Use MODULE_LICENSE("Dual MIT/GPL") in Linux .ko modules so Linux modpost permits linking against the kernel's own EXPORT_SYMBOL_GPL symbols while keeping the repository source 100% MIT.

Closes #12.
2026-12-01 00:20:02 +00:00

23 lines
588 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)
{
struct timespec64 now;
jiffies_to_timespec64(jiffies, &now);
return (u64)timespec64_to_ns(&now);
}
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);
*seconds = (u32)now.tv_sec;
*microseconds = now.tv_nsec / NSEC_PER_USEC;
}