Arduino-RTC
Real-Time Clock (RTC) library for Arduino
RTC Class Reference

#include <RTC.h>

Collaboration diagram for RTC:
Collaboration graph

Public Member Functions

 RTC ()
 
bool tick ()
 
time_t get_time ()
 
void set_time (time_t time)
 
void get_time (struct tm &now)
 
void set_time (struct tm &now)
 
 RTC ()
 
bool tick ()
 
time_t get_time ()
 
void set_time (time_t time)
 
void get_time (struct tm &now)
 
void set_time (struct tm &now)
 

Protected Attributes

volatile uint16_t m_millis
 
volatile time_t m_time
 

Detailed Description

Software Real-Time Clock.

Definition at line 25 of file RTC.h.

Constructor & Destructor Documentation

RTC::RTC ( )
inline

Construct software real-time clock based on millis().

Definition at line 30 of file RTC.h.

RTC::RTC ( )
inline

Construct software real-time clock based on millis().

Definition at line 89 of file RTC.h.

Member Function Documentation

time_t RTC::get_time ( )
inline

Return the current time in seconds from epoch.

Definition at line 55 of file RTC.h.

void RTC::get_time ( struct tm now)
inline

Return the current time as a time structure.

Definition at line 80 of file RTC.h.

time_t RTC::get_time ( )
inline

Current time in seconds from epoch.

Returns
seconds from epoch.

Definition at line 111 of file RTC.h.

void RTC::get_time ( struct tm now)
inline

Return the current time as a time structure.

Definition at line 128 of file RTC.h.

void RTC::set_time ( time_t  time)
inline

Set the current time (seconds) from epoch.

Definition at line 68 of file RTC.h.

void RTC::set_time ( struct tm now)
inline

Set the current time based on the given time structure.

Definition at line 89 of file RTC.h.

void RTC::set_time ( time_t  time)
inline

Set the current time (seconds) from epoch.

Definition at line 120 of file RTC.h.

void RTC::set_time ( struct tm now)
inline

Set the current time based on the given time structure.

Definition at line 137 of file RTC.h.

bool RTC::tick ( )
inline

Increment seconds counter when time has elapsed. Return true(1) if an increment occured, otherwise false(0).

Definition at line 39 of file RTC.h.

bool RTC::tick ( )
inline

Increment seconds counter when time has elapsed.

Returns
true(1) if an increment occured, otherwise false(0).

Definition at line 98 of file RTC.h.

Member Data Documentation

volatile uint16_t RTC::m_millis
protected

Timestamp for previous tick call.

Definition at line 97 of file RTC.h.

volatile time_t RTC::m_time
protected

Current time from epoch.

Definition at line 100 of file RTC.h.


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