Files
c3c/lib/std/time/clock.c3
Christoffer Lerno 4c1edfb941 Dev (#777)
* The new @if directive.
2023-06-10 23:16:28 +02:00

23 lines
359 B
C

module std::time::clock;
fn Clock now()
{
$if $defined(native_clock):
return os::native_clock();
$else
return 0;
$endif
}
fn NanoDuration Clock.mark(Clock* this)
{
Clock mark = now();
NanoDuration diff = (NanoDuration)(mark - *this);
*this = mark;
return diff;
}
fn NanoDuration Clock.to_now(Clock this)
{
return (NanoDuration)(now() - this);
}