Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TimeSpan Class Reference
Timespan which can represent changes in time with seconds accuracy. More...
#include <RTClib.h>
Public Member Functions | |
| TimeSpan (int32_t seconds=0) | |
| Create a new TimeSpan object in seconds. | |
| TimeSpan (int16_t days, int8_t hours, int8_t minutes, int8_t seconds) | |
| Create a new TimeSpan object using a number of days/hours/minutes/seconds e.g. Make a TimeSpan of 3 hours and 45 minutes: new TimeSpan(0, 3, 45, 0);. | |
| TimeSpan (const TimeSpan ©) | |
| Copy constructor, make a new TimeSpan using an existing one. | |
| int16_t | days () const |
| Number of days in the TimeSpan e.g. 4. | |
| int8_t | hours () const |
| Number of hours in the TimeSpan This is not the total hours, it includes the days e.g. 4 days, 3 hours - NOT 99 hours. | |
| int8_t | minutes () const |
| Number of minutes in the TimeSpan This is not the total minutes, it includes days/hours e.g. 4 days, 3 hours, 27 minutes. | |
| int8_t | seconds () const |
| Number of seconds in the TimeSpan This is not the total seconds, it includes the days/hours/minutes e.g. 4 days, 3 hours, 27 minutes, 7 seconds. | |
| int32_t | totalseconds () const |
| Total number of seconds in the TimeSpan, e.g. 358027. | |
| TimeSpan | operator+ (const TimeSpan &right) |
| Add two TimeSpans. | |
| TimeSpan | operator- (const TimeSpan &right) |
| Subtract a TimeSpan. | |
Protected Attributes | |
| int32_t | _seconds |
| Actual TimeSpan value is stored as seconds. | |
Detailed Description
Timespan which can represent changes in time with seconds accuracy.
Definition at line 195 of file RTClib.h.
Constructor & Destructor Documentation
| TimeSpan | ( | int32_t | seconds = 0 ) |
Create a new TimeSpan object in seconds.
- Parameters:
-
seconds Number of seconds
Definition at line 498 of file RTClib.cpp.
| TimeSpan | ( | int16_t | days, |
| int8_t | hours, | ||
| int8_t | minutes, | ||
| int8_t | seconds | ||
| ) |
Create a new TimeSpan object using a number of days/hours/minutes/seconds e.g. Make a TimeSpan of 3 hours and 45 minutes: new TimeSpan(0, 3, 45, 0);.
- Parameters:
-
days Number of days hours Number of hours minutes Number of minutes seconds Number of seconds
Definition at line 512 of file RTClib.cpp.
Copy constructor, make a new TimeSpan using an existing one.
- Parameters:
-
copy The TimeSpan to copy
Definition at line 522 of file RTClib.cpp.
Member Function Documentation
| int16_t days | ( | ) | const |
| int8_t hours | ( | ) | const |
| int8_t minutes | ( | ) | const |
Add two TimeSpans.
- Parameters:
-
right TimeSpan to add
- Returns:
- New TimeSpan object, sum of left and right
Definition at line 533 of file RTClib.cpp.
Subtract a TimeSpan.
- Parameters:
-
right TimeSpan to subtract
- Returns:
- New TimeSpan object, right subtracted from left
Definition at line 545 of file RTClib.cpp.
| int8_t seconds | ( | ) | const |
| int32_t totalseconds | ( | ) | const |
Field Documentation
Generated on Wed Jul 13 2022 06:14:12 by
1.7.2