mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add ConditionVariable.wait_until and ConditionVariable.wait_for (#2302)
* Add `ConditionVariable.wait_until` and `ConditionVariable.wait_for` * Add "@structlike" for typedefs. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
committed by
GitHub
parent
448176b0b7
commit
2053f2767b
@@ -4,7 +4,7 @@ import std::time;
|
||||
<*
|
||||
Return a "timespec" from a duration.
|
||||
|
||||
@require self >= 0
|
||||
@require self >= time::NANO_DURATION_ZERO
|
||||
*>
|
||||
fn TimeSpec NanoDuration.to_timespec(self) @inline
|
||||
{
|
||||
@@ -16,7 +16,7 @@ fn TimeSpec NanoDuration.to_timespec(self) @inline
|
||||
<*
|
||||
Convert a duration to a timespec.
|
||||
|
||||
@require self >= 0
|
||||
@require self >= time::DURATION_ZERO
|
||||
*>
|
||||
fn TimeSpec Duration.to_timespec(self) @inline
|
||||
{
|
||||
@@ -24,3 +24,11 @@ fn TimeSpec Duration.to_timespec(self) @inline
|
||||
Time_t sec = (Time_t)(self / time::SEC);
|
||||
return { .s = sec, .ns = ns };
|
||||
}
|
||||
|
||||
<*
|
||||
Convert a timestamp to a timespec.
|
||||
*>
|
||||
fn TimeSpec Time.to_timespec(self) @inline
|
||||
{
|
||||
return ((Duration)self).to_timespec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user