class::chrono::Time

class chrono::Time
  : public api::InfoObject

This class is for accessing the current time as well as adding and subtracting times and dates.

The time is based on the value of the RTC in the system. The RTC will keep the same value even when the device is reset. This class should provide accurate access to the current data and time.

It holds a c style time_t value that can be managed which is a 32-bit value with accuracy to the second.

Time now; //current time
Time ten_minutes(0, 10, 0); //duration of 10 minutes

now += ten_minutes; //adds ten minutes to now

Summary

Time()

explicit [Time](#classchrono_1_1_time_1a22b351aaca182739cd36abf032b714de)(  

const time_t & t
)

Time(

const Seconds & seconds,
const Minutes & minutes,
const Hours & hours
)

[Time](#classchrono_1_1_time_1a063e40501e80370336aced26e2c64460)(  

const Minutes & minutes
)

[Time](#classchrono_1_1_time_1a7a64976303f46d8f066033d462bfa5c0)(  

const Hours & hours
)

Time age() const

time_t ctime() const

u32 day() const

struct tm get_tm() const

u32 hour() const

bool is_valid()

u32 minute() const

u32 month() const

const var::ConstString month_name() const

bool operator !=(

const Time & a
) const

Time operator -(

const Time & a
) const

bool operator >(

const Time & a
) const

bool operator >=(

const Time & a
) const

Time operator+(

const Time & a
) const

Time & operator+=(

const Time & a
)

Time & operator-=(

const Time & a
)

bool operator<(

const Time & a
) const

bool operator<=(

const Time & a
) const

Time & operator=(

const Time & a
)

Time & operator=(

u32 a
)

bool operator==(

const Time & a
) const

u32 second() const

void set_time(

const Seconds & sec,
const Minutes & min,
const Hours & hour
)

void set_time(

time_t tm
)

int set_time_of_day()

time_t time() const

u32 weekday() const

u32 year() const

u32 yearday() const

static Time current_time()

static Time from_days(

u32 value
)

static Time from_hours(

u32 value
)

static Time from_minutes(

u32 value
)

static Time from_seconds(

u32 value
)

static Time from_weeks(

u32 value
)

static Time get_time_of_day()

static int set_time_of_day(

const Time & t
)

Members

Time()

Constructs using current time.


explicit Time(

const time_t & t
)


Time(

const Seconds & seconds,
const Minutes & minutes,
const Hours & hours
)

Constructs using an amount of time.


Time(

const Minutes & minutes
)


Time(

const Hours & hours
)


Time age() const

time_t ctime() const

Returns the time value (number of seconds since epoch).


u32 day() const

Returns the day of month (from 1 to 31).


struct tm get_tm() const

Converts the time to a struct tm.


u32 hour() const

Returns hours (from 0 to 23).


bool is_valid()

u32 minute() const

Returns minutes (from 0 to 59).


u32 month() const

Returns the month (from 1 to 12).


const var::ConstString month_name() const

Gets the name of the month.


bool operator !=(

const Time & a
) const


Time operator -(

const Time & a
) const


bool operator >(

const Time & a
) const


bool operator >=(

const Time & a
) const


Time operator+(

const Time & a
) const


Time & operator+=(

const Time & a
)

Adds to the current value.


Time & operator-=(

const Time & a
)

Subtracts from the current value.


bool operator<(

const Time & a
) const


bool operator<=(

const Time & a
) const


Time & operator=(

const Time & a
)

Assigns another Time.


Time & operator=(

u32 a
)

Assigns another time value (time_t).


bool operator==(

const Time & a
) const


u32 second() const

Returns seconds (from 0 to 59).


void set_time(

const Seconds & sec,
const Minutes & min,
const Hours & hour
)

Sets the value in Time to a number of seconds.

This Time object will hold a duration of time rather than a calendar time.


void set_time(

time_t tm
)

Sets the current value.


int set_time_of_day()

Sets the system time to the time stored in this object.


time_t time() const

u32 weekday() const

Returns the day of week (from 1 to 7).


u32 year() const

Returns the year (e.g. 2014)


u32 yearday() const

Returns the day of the year (1 to 366).


static Time current_time()

static Time from_days(

u32 value
)


static Time from_hours(

u32 value
)


static Time from_minutes(

u32 value
)


static Time from_seconds(

u32 value
)


static Time from_weeks(

u32 value
)


static Time get_time_of_day()

Assigns the system time of day to the time stored in this object and returns the current system time.


static int set_time_of_day(

const Time & t
)

Sets the system time


X

Thanks for Coming!

Subscribe to news and updates