Struct Alarm
- Namespace
- Luny
/ - Assembly
- Luny.dll
A lightweight readonly struct representing a fixed point in the future.
Used for high-performance polling in update loops.
public readonly struct Alarm : IComparable<Alarm>, IComparable<Double>, IEquatable<Alarm>, IEquatable<Double>
Expand Details ...
- Implements
-
Constructors
Alarm(Double)
Creates an alarm set to fire after the specified time or ticks.
public Alarm(Double target)
Parameters
| Type |
Name |
Description |
- Double
|
target |
|
Fields
Target
public readonly Double Target
Field Value
- Double
Methods
At(Double)
Creates an alarm at a specific absolute time.
public static Alarm At(Double absoluteTime)
Parameters
| Type |
Name |
Description |
- Double
|
absoluteTime |
|
Returns
- Alarm
At(Int64)
Creates an alarm at a specific total number of ticks.
public static Alarm At(Int64 totalTicks)
Parameters
| Type |
Name |
Description |
- Int64
|
totalTicks |
|
Returns
- Alarm
CompareTo(Alarm)
public Int32 CompareTo(Alarm other)
Parameters
| Type |
Name |
Description |
- Alarm
|
other |
|
Returns
- Int32
CompareTo(Double)
public Int32 CompareTo(Double other)
Parameters
| Type |
Name |
Description |
- Double
|
other |
|
Returns
- Int32
Equals(Alarm)
public Boolean Equals(Alarm other)
Parameters
| Type |
Name |
Description |
- Alarm
|
other |
|
Returns
- Boolean
Equals(Double)
public Boolean Equals(Double other)
Parameters
| Type |
Name |
Description |
- Double
|
other |
|
Returns
- Boolean
Equals(Object)
public override Boolean Equals(Object obj)
Parameters
| Type |
Name |
Description |
- Object
|
obj |
|
Returns
- Boolean
From(Double)
Returns a new alarm relative to the provided time.
Example: Alarm.In(5).From(Time.ElapsedSeconds)
public Alarm From(Double now)
Parameters
| Type |
Name |
Description |
- Double
|
now |
|
Returns
- Alarm
From(Int64)
Returns a new alarm relative to the provided tick.
Example: Alarm.In(5).From(Time.FrameCount)
public Alarm From(Int64 currentTick)
Parameters
| Type |
Name |
Description |
- Int64
|
currentTick |
|
Returns
- Alarm
GetHashCode()
public override Int32 GetHashCode()
Returns
- Int32
In(Double)
Creates an alarm set to fire after the specified seconds.
Note: Use From(now) to make it relative to a specific time.
public static Alarm In(Double seconds)
Parameters
| Type |
Name |
Description |
- Double
|
seconds |
|
Returns
- Alarm
In(Int64)
Creates an alarm set to fire after the specified number of ticks.
Note: Use From(now) to make it relative to a specific tick count.
public static Alarm In(Int64 ticks)
Parameters
| Type |
Name |
Description |
- Int64
|
ticks |
|
Returns
- Alarm
InHours(Double)
Creates an alarm set to fire after the specified hours.
public static Alarm InHours(Double h)
Parameters
| Type |
Name |
Description |
- Double
|
h |
|
Returns
- Alarm
InMilliseconds(Double)
Creates an alarm set to fire after the specified milliseconds.
public static Alarm InMilliseconds(Double ms)
Parameters
| Type |
Name |
Description |
- Double
|
ms |
|
Returns
- Alarm
InMinutes(Double)
Creates an alarm set to fire after the specified minutes.
public static Alarm InMinutes(Double m)
Parameters
| Type |
Name |
Description |
- Double
|
m |
|
Returns
- Alarm
IsElapsed(Double)
Returns true if the target time has been reached or passed.
public Boolean IsElapsed(Double now)
Parameters
| Type |
Name |
Description |
- Double
|
now |
|
Returns
- Boolean
RemainingMilliseconds(Double)
Returns the remaining time in milliseconds.
public Double RemainingMilliseconds(Double now)
Parameters
| Type |
Name |
Description |
- Double
|
now |
|
Returns
- Double
RemainingMinutes(Double)
Returns the remaining time in minutes.
public Double RemainingMinutes(Double now)
Parameters
| Type |
Name |
Description |
- Double
|
now |
|
Returns
- Double
RemainingSeconds(Double)
Returns the remaining time in seconds.
public Double RemainingSeconds(Double now)
Parameters
| Type |
Name |
Description |
- Double
|
now |
|
Returns
- Double
ToString()
public override String ToString()
Returns
- String
Operators
operator ==(Alarm, Alarm)
public static Boolean operator ==(Alarm left, Alarm right)
Parameters
Returns
- Boolean
operator ==(Alarm, Double)
public static Boolean operator ==(Alarm left, Double right)
Parameters
| Type |
Name |
Description |
- Alarm
|
left |
|
- Double
|
right |
|
Returns
- Boolean
operator ==(Double, Alarm)
public static Boolean operator ==(Double left, Alarm right)
Parameters
| Type |
Name |
Description |
- Double
|
left |
|
- Alarm
|
right |
|
Returns
- Boolean
operator >(Alarm, Alarm)
public static Boolean operator >(Alarm left, Alarm right)
Parameters
Returns
- Boolean
operator >(Alarm, Double)
public static Boolean operator >(Alarm left, Double right)
Parameters
| Type |
Name |
Description |
- Alarm
|
left |
|
- Double
|
right |
|
Returns
- Boolean
operator >(Double, Alarm)
public static Boolean operator >(Double left, Alarm right)
Parameters
| Type |
Name |
Description |
- Double
|
left |
|
- Alarm
|
right |
|
Returns
- Boolean
operator >=(Alarm, Alarm)
public static Boolean operator >=(Alarm left, Alarm right)
Parameters
Returns
- Boolean
operator >=(Alarm, Double)
public static Boolean operator >=(Alarm left, Double right)
Parameters
| Type |
Name |
Description |
- Alarm
|
left |
|
- Double
|
right |
|
Returns
- Boolean
operator >=(Double, Alarm)
public static Boolean operator >=(Double left, Alarm right)
Parameters
| Type |
Name |
Description |
- Double
|
left |
|
- Alarm
|
right |
|
Returns
- Boolean
operator !=(Alarm, Alarm)
public static Boolean operator !=(Alarm left, Alarm right)
Parameters
Returns
- Boolean
operator !=(Alarm, Double)
public static Boolean operator !=(Alarm left, Double right)
Parameters
| Type |
Name |
Description |
- Alarm
|
left |
|
- Double
|
right |
|
Returns
- Boolean
operator !=(Double, Alarm)
public static Boolean operator !=(Double left, Alarm right)
Parameters
| Type |
Name |
Description |
- Double
|
left |
|
- Alarm
|
right |
|
Returns
- Boolean
operator <(Alarm, Alarm)
public static Boolean operator <(Alarm left, Alarm right)
Parameters
Returns
- Boolean
operator <(Alarm, Double)
public static Boolean operator <(Alarm left, Double right)
Parameters
| Type |
Name |
Description |
- Alarm
|
left |
|
- Double
|
right |
|
Returns
- Boolean
operator <(Double, Alarm)
public static Boolean operator <(Double left, Alarm right)
Parameters
| Type |
Name |
Description |
- Double
|
left |
|
- Alarm
|
right |
|
Returns
- Boolean
operator <=(Alarm, Alarm)
public static Boolean operator <=(Alarm left, Alarm right)
Parameters
Returns
- Boolean
operator <=(Alarm, Double)
public static Boolean operator <=(Alarm left, Double right)
Parameters
| Type |
Name |
Description |
- Alarm
|
left |
|
- Double
|
right |
|
Returns
- Boolean
operator <=(Double, Alarm)
public static Boolean operator <=(Double left, Alarm right)
Parameters
| Type |
Name |
Description |
- Double
|
left |
|
- Alarm
|
right |
|
Returns
- Boolean