RTClib
Public Member Functions | 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>

Public Member Functions

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

Protected Attributes

uint32_t microsPerSecond = 1000000
 
uint32_t lastUnix
 
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()

void RTC_Micros::begin ( const DateTime dt)
inline

Start the RTC.

Parameters
dtDateTime object with the date/time to set

◆ adjust()

void RTC_Micros::adjust ( const DateTime dt)

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)

Adjust the RTC_Micros clock to compensate for system clock drift.

Parameters
ppmAdjustment to make. A positive adjustment makes the clock faster.

◆ now()

DateTime RTC_Micros::now ( )

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
protected

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

◆ lastUnix

uint32_t RTC_Micros::lastUnix
protected

Unix time from the previous call to now().

The timing logic is identical to RTC_Millis.

◆ lastMicros

uint32_t RTC_Micros::lastMicros
protected

micros() value corresponding to lastUnix.


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