Feature #762
Von Maximilian Seesslen vor etwa 3 Stunden aktualisiert
This can make code look nicer:
<pre><code class="cpp">
typedef int time_t;
consteval time_t operator ""_minutes( unsigned long long a)
{
return ( a * 60 );
}
consteval time_t operator ""_minutes( double a)
{
return ( a * 60 );
}
if( elapsedMs( &ms, 2_hours ) )
{
switchOff();
}
</code></pre>
A struct can be added:
<pre><code class="cpp">
struct Timer
{
lrtimer_t m_timer;
Timer(lrtimer_t t):m_timer(t){};
Timer():m_timer(0){};
bool elapsed( lrtimer_t t )
{
return(false);
}
};
Timer t;
t.elapsed( 2.5_minutes );
</code></pre>
<pre><code class="cpp">
typedef int time_t;
consteval time_t operator ""_minutes( unsigned long long a)
{
return ( a * 60 );
}
consteval time_t operator ""_minutes( double a)
{
return ( a * 60 );
}
if( elapsedMs( &ms, 2_hours ) )
{
switchOff();
}
</code></pre>
A struct can be added:
<pre><code class="cpp">
struct Timer
{
lrtimer_t m_timer;
Timer(lrtimer_t t):m_timer(t){};
Timer():m_timer(0){};
bool elapsed( lrtimer_t t )
{
return(false);
}
};
Timer t;
t.elapsed( 2.5_minutes );
</code></pre>