Date and time functions
Collaboration diagram for Date and time functions:

Modules

 Network Time Protocol client
 Provides NTP client.
 
 Real Time Clock
 Access to the real time clock.
 
 System clock functions
 Provides system clock functions.
 
 Time and Delay
 Provides time and delay functions.
 

Classes

class  DateTime
 Date and time class. More...
 

Macros

#define SECS_PER_MIN   (60UL)
 
#define SECS_PER_HOUR   (3600UL)
 
#define SECS_PER_DAY   (SECS_PER_HOUR * 24L)
 
#define DAYS_PER_WEEK   (7L)
 
#define SECS_PER_WEEK   (SECS_PER_DAY * DAYS_PER_WEEK)
 
#define SECS_PER_YEAR   (SECS_PER_WEEK * 52L)
 
#define SECS_YR_2000   (946681200UL)
 

Enumerations

enum  dtDays_t {
  dtSunday , dtMonday , dtTuesday , dtWednesday ,
  dtThursday , dtFriday , dtSaturday
}
 Days of week. More...
 
enum  dtMonth_t {
  dtJanuary , dtFebruary , dtMarch , dtApril ,
  dtMay , dtJune , dtJuly , dtAugust ,
  dtSeptember , dtOctober , dtNovember , dtDecember
}
 Months. More...
 

Functions

constexpr uint8_t numberOfSeconds (time_t time)
 
constexpr uint8_t numberOfMinutes (time_t time)
 
constexpr uint8_t numberOfHours (time_t time)
 
constexpr dtDays_t dayOfWeek (time_t time)
 
constexpr uint8_t elapsedDays (time_t time)
 
constexpr unsigned elapsedSecsToday (time_t time)
 
constexpr time_t previousMidnight (time_t time)
 
constexpr time_t nextMidnight (time_t time)
 
constexpr unsigned elapsedSecsThisWeek (time_t time)
 

Detailed Description

Macro Definition Documentation

◆ DAYS_PER_WEEK

#define DAYS_PER_WEEK   (7L)

◆ SECS_PER_DAY

#define SECS_PER_DAY   (SECS_PER_HOUR * 24L)

◆ SECS_PER_HOUR

#define SECS_PER_HOUR   (3600UL)

◆ SECS_PER_MIN

#define SECS_PER_MIN   (60UL)

◆ SECS_PER_WEEK

#define SECS_PER_WEEK   (SECS_PER_DAY * DAYS_PER_WEEK)

◆ SECS_PER_YEAR

#define SECS_PER_YEAR   (SECS_PER_WEEK * 52L)

◆ SECS_YR_2000

#define SECS_YR_2000   (946681200UL)

Enumeration Type Documentation

◆ dtDays_t

enum dtDays_t

Days of week.

Enumerator
dtSunday 
dtMonday 
dtTuesday 
dtWednesday 
dtThursday 
dtFriday 
dtSaturday 

◆ dtMonth_t

enum dtMonth_t

Months.

Enumerator
dtJanuary 
dtFebruary 
dtMarch 
dtApril 
dtMay 
dtJune 
dtJuly 
dtAugust 
dtSeptember 
dtOctober 
dtNovember 
dtDecember 

Function Documentation

◆ dayOfWeek()

constexpr dtDays_t dayOfWeek ( time_t  time)
inlineconstexpr

Get day of week from given Unix time

◆ elapsedDays()

constexpr uint8_t elapsedDays ( time_t  time)
inlineconstexpr

Get elapsed days since 1970-01-01 from given Unix time

◆ elapsedSecsThisWeek()

constexpr unsigned elapsedSecsThisWeek ( time_t  time)
inlineconstexpr

Get quantity of seconds since midnight at start of previous Sunday from given Unix time

◆ elapsedSecsToday()

constexpr unsigned elapsedSecsToday ( time_t  time)
inlineconstexpr

Get quantity of seconds since midnight from given Unix time

◆ nextMidnight()

constexpr time_t nextMidnight ( time_t  time)
inlineconstexpr

Get Unix time of midnight at end of day from given just Unix time

◆ numberOfHours()

constexpr uint8_t numberOfHours ( time_t  time)
inlineconstexpr

Get just hours part of given Unix time

◆ numberOfMinutes()

constexpr uint8_t numberOfMinutes ( time_t  time)
inlineconstexpr

Get just minutes part of given Unix time

◆ numberOfSeconds()

constexpr uint8_t numberOfSeconds ( time_t  time)
inlineconstexpr

Get just seconds part of given Unix time

◆ previousMidnight()

constexpr time_t previousMidnight ( time_t  time)
inlineconstexpr

Get Unix time of midnight at start of day from given Unix time