semf
semf::Clock Class Reference

The Clock class provides real time clock functionality. It can return a DateTime object with actual date and time information from Rtc and the Rtc can be updated by setting a DateTime object to Clock. More...

#include <clock.h>

Inheritance diagram for semf::Clock:
Inheritance graph
Collaboration diagram for semf::Clock:
Collaboration graph

Public Member Functions

 Clock (Rtc &rtc)
 Constructor. More...
 
 Clock (const Clock &other)=delete
 
DateTimenow () override
 Returns the momentary date time from Rtc. More...
 
void set (DateTime &datetimeToSet) override
 Sets the DateTime information from datetimeToSet to the Rtc. More...
 
app::Clockoperator= (const DateTime &datetimeToSet) override
 Copies the date time. More...
 
- Public Member Functions inherited from semf::app::Clock
virtual ~Clock ()=default
 
virtual DateTimenow ()=0
 Returns the momentary date time from Rtc. More...
 
virtual void set (DateTime &datetimeToSet)=0
 Sets the DateTime information from datetimeToSet to the Rtc. More...
 
virtual Clockoperator= (const DateTime &datetimeToSet)=0
 Copies the date time. More...
 

Detailed Description

The Clock class provides real time clock functionality. It can return a DateTime object with actual date and time information from Rtc and the Rtc can be updated by setting a DateTime object to Clock.

The Rtc date and time can be modified by set().

See also
DateTime
Date
Time.

Definition at line 21 of file clock.h.

Constructor & Destructor Documentation

◆ Clock() [1/2]

semf::Clock::Clock ( Rtc rtc)
explicit

Constructor.

Parameters
rtcRtc object to use in Clock.

Definition at line 15 of file clock.cpp.

◆ Clock() [2/2]

semf::Clock::Clock ( const Clock other)
explicitdelete

Member Function Documentation

◆ now()

DateTime & semf::Clock::now ( )
overridevirtual

Returns the momentary date time from Rtc.

Returns
DateTime object with Rtc date and time information.

Implements semf::app::Clock.

Definition at line 20 of file clock.cpp.

Here is the call graph for this function:

◆ operator=()

app::Clock & semf::Clock::operator= ( const DateTime datetimeToSet)
overridevirtual

Copies the date time.

Parameters
datetimeToSetSource to copy the DateTime information from.
Returns
system clock object itself.

Implements semf::app::Clock.

Definition at line 38 of file clock.cpp.

Here is the call graph for this function:

◆ set()

void semf::Clock::set ( DateTime datetimeToSet)
overridevirtual

Sets the DateTime information from datetimeToSet to the Rtc.

Parameters
datetimeToSetdate and time source for Rtc.

Implements semf::app::Clock.

Definition at line 27 of file clock.cpp.

Here is the call graph for this function: