Files
c3c/lib/std/time/os/time_posix.c3
Christoffer Lerno abe4727c3a Deprecate uXX and iXX bit suffixes.
Add experimental LL / ULL suffixes for int128 and uint128 literals.
2025-05-13 23:48:59 +02:00

18 lines
393 B
Plaintext

module std::time::os @if(env::POSIX);
import libc, std::os::posix;
fn Time native_timestamp()
{
TimeSpec ts;
posix::clock_gettime(posix::CLOCK_REALTIME, &ts);
return (Time)(ts.s * 1_000_000L + ts.ns / 1_000L);
}
fn Clock native_clock() @if(!env::DARWIN)
{
TimeSpec ts;
posix::clock_gettime(posix::CLOCK_MONOTONIC, &ts);
return (Clock)((ulong)ts.s * 1_000_000_000UL + (ulong)ts.ns);
}