Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
teensy_clock.cpp
Go to the documentation of this file.
1#include "teensy_clock.h"
2#include "cycles64.h"
3
4void teensy_clock::begin(bool sync)
5{
7 if (sync) syncToRTC();
8}
9
11{
12 using namespace std::chrono;
13 return std::time_t(duration_cast<seconds>(t.time_since_epoch()).count());
14}
15
17{
18 using namespace std::chrono;
19 typedef std::chrono::time_point<teensy_clock, seconds> from;
21}
22
24{
25 t0 = ((uint64_t)rtc_get()) * F_CPU - cycles64::get();
26}
27
28uint64_t teensy_clock::t0 = 0;
int t
Definition logging.cpp:17
uint64_t get()
Definition cycle64.cpp:23
void begin()
Definition cycle64.cpp:39
static std::time_t to_time_t(const time_point &t)
static void syncToRTC()
static void begin(bool sync=true)
std::chrono::time_point< teensy_clock, duration > time_point
static time_point from_time_t(std::time_t t)