mirror of
https://github.com/PaulStoffregen/Time.git
synced 2025-07-30 06:07:13 +02:00
Fixed typos in TimeLib.h and Time.cpp
Change-Id: Ia05c370e8f09b75dddf11cf2aa8b5de4c21bd45d
This commit is contained in:
6
Time.cpp
6
Time.cpp
@ -141,9 +141,9 @@ int year(time_t t) { // the year for the given time
|
|||||||
|
|
||||||
/*============================================================================*/
|
/*============================================================================*/
|
||||||
/* functions to convert to and from system time */
|
/* functions to convert to and from system time */
|
||||||
/* These are for interfacing with time serivces and are not normally needed in a sketch */
|
/* These are for interfacing with time services and are not normally needed in a sketch */
|
||||||
|
|
||||||
// leap year calulator expects year argument as years offset from 1970
|
// leap year calculator expects year argument as years offset from 1970
|
||||||
#define LEAP_YEAR(Y) ( ((1970+(Y))>0) && !((1970+(Y))%4) && ( ((1970+(Y))%100) || !((1970+(Y))%400) ) )
|
#define LEAP_YEAR(Y) ( ((1970+(Y))>0) && !((1970+(Y))%4) && ( ((1970+(Y))%100) || !((1970+(Y))%400) ) )
|
||||||
|
|
||||||
static const uint8_t monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; // API starts months from 1, this array starts from 0
|
static const uint8_t monthDays[]={31,28,31,30,31,30,31,31,30,31,30,31}; // API starts months from 1, this array starts from 0
|
||||||
@ -213,7 +213,7 @@ time_t makeTime(const tmElements_t &tm){
|
|||||||
seconds= tm.Year*(SECS_PER_DAY * 365);
|
seconds= tm.Year*(SECS_PER_DAY * 365);
|
||||||
for (i = 0; i < tm.Year; i++) {
|
for (i = 0; i < tm.Year; i++) {
|
||||||
if (LEAP_YEAR(i)) {
|
if (LEAP_YEAR(i)) {
|
||||||
seconds += SECS_PER_DAY; // add extra days for leap years
|
seconds += SECS_PER_DAY; // add extra days for leap years
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ typedef time_t(*getExternalTime)();
|
|||||||
#define elapsedDays(_time_) ((_time_) / SECS_PER_DAY) // this is number of days since Jan 1 1970
|
#define elapsedDays(_time_) ((_time_) / SECS_PER_DAY) // this is number of days since Jan 1 1970
|
||||||
#define elapsedSecsToday(_time_) ((_time_) % SECS_PER_DAY) // the number of seconds since last midnight
|
#define elapsedSecsToday(_time_) ((_time_) % SECS_PER_DAY) // the number of seconds since last midnight
|
||||||
// The following macros are used in calculating alarms and assume the clock is set to a date later than Jan 1 1971
|
// The following macros are used in calculating alarms and assume the clock is set to a date later than Jan 1 1971
|
||||||
// Always set the correct time before settting alarms
|
// Always set the correct time before setting alarms
|
||||||
#define previousMidnight(_time_) (((_time_) / SECS_PER_DAY) * SECS_PER_DAY) // time at the start of the given day
|
#define previousMidnight(_time_) (((_time_) / SECS_PER_DAY) * SECS_PER_DAY) // time at the start of the given day
|
||||||
#define nextMidnight(_time_) (previousMidnight(_time_) + SECS_PER_DAY) // time at the end of the given day
|
#define nextMidnight(_time_) (previousMidnight(_time_) + SECS_PER_DAY) // time at the end of the given day
|
||||||
#define elapsedSecsThisWeek(_time_) (elapsedSecsToday(_time_) + ((dayOfWeek(_time_)-1) * SECS_PER_DAY)) // note that week starts on day 1
|
#define elapsedSecsThisWeek(_time_) (elapsedSecsToday(_time_) + ((dayOfWeek(_time_)-1) * SECS_PER_DAY)) // note that week starts on day 1
|
||||||
|
Reference in New Issue
Block a user