RTClib
Static Public Member Functions | Static Protected Attributes | List of all members
RTC_Micros Class Reference

RTC using the internal micros() clock, has to be initialized before use. Unlike RTC_Millis, this can be tuned in order to compensate for the natural drift of the system clock. Note that now() has to be called more frequently than the micros() rollover period, which is approximately 71.6 minutes. More...

#include <RTClib.h>

Static Public Member Functions

static void begin (const DateTime &dt)
 Start the RTC. More...
 
static void adjust (const DateTime &dt)
 Set the current date/time of the RTC_Micros clock. More...
 
static void adjustDrift (int ppm)
 Adjust the RTC_Micros clock to compensate for system clock drift. More...
 
static DateTime now ()
 Get the current date/time from the RTC_Micros clock. More...
 

Static Protected Attributes

static uint32_t microsPerSecond = 1000000
 
static uint32_t lastUnix
 
static uint32_t lastMicros
 

Detailed Description

RTC using the internal micros() clock, has to be initialized before use. Unlike RTC_Millis, this can be tuned in order to compensate for the natural drift of the system clock. Note that now() has to be called more frequently than the micros() rollover period, which is approximately 71.6 minutes.

Member Function Documentation

◆ begin()

static void RTC_Micros::begin ( const DateTime dt)
inlinestatic

Start the RTC.

Parameters
dtDateTime object with the date/time to set

◆ adjust()

void RTC_Micros::adjust ( const DateTime dt)
static

Set the current date/time of the RTC_Micros clock.

Parameters
dtDateTime object with the desired date and time

◆ adjustDrift()

void RTC_Micros::adjustDrift ( int  ppm)
static

Adjust the RTC_Micros clock to compensate for system clock drift.

Parameters
ppmAdjustment to make

◆ now()

DateTime RTC_Micros::now ( )
static

Get the current date/time from the RTC_Micros clock.

Returns
DateTime object containing the current date/time

Member Data Documentation

◆ microsPerSecond

uint32_t RTC_Micros::microsPerSecond = 1000000
staticprotected

Number of microseconds reported by micros() per "true" (calibrated) second

Number of microseconds reported by micros() per "true" (calibrated) second.

◆ lastUnix

uint32_t RTC_Micros::lastUnix
staticprotected

Unix time from the previous call to now() - prevents rollover issues

◆ lastMicros

uint32_t RTC_Micros::lastMicros
staticprotected

micros() value corresponding to the last full second of Unix time

The timing logic is identical to RTC_Millis.


The documentation for this class was generated from the following files: