Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@ int add_iso8601_utc_datetime(char* buf, size_t size) {

#endif

#ifdef ARDUINO

int64_t usec_now()
{
return micros();
}

void get_time(uint32_t *seconds, uint32_t *micro_seconds)
{
*micro_seconds = micros();
*seconds = *micro_seconds / 1000000;
*micro_seconds %= 1000000;
}

#else

int64_t usec_now()
{
int64_t usec;
Expand All @@ -204,6 +220,8 @@ void get_time(uint32_t *seconds, uint32_t *micro_seconds)
*micro_seconds = tv.tv_usec;
}

#endif

int64_t usec_since(int64_t last)
{
return usec_now() - last;
Expand Down