blob: 84c7d968def237d5f2d11769cbc76bedebf75755 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "time_utils.hpp"
#include "Arduino.h"
Time::Time(unsigned long time_micros)
{
_time_micros = time_micros;
}
void Time::update()
{
_time_micros = micros();
}
Time Time::diff(Time prev_time)
{
return Time(_time_micros - prev_time.microsecs());
}
unsigned long Time::microsecs()
{
return _time_micros;
}
unsigned long Time::millisecs()
{
return _time_micros * 0.001;
}
float Time::secs()
{
return _time_micros * 0.000001;
}
Time time_now()
{
return Time(micros());
}
|