edelib  2.1.0
Public Member Functions | Static Public Member Functions | List of all members
Time Class Reference

A class for time manipulation. More...

#include <edelib/DateTime.h>

Public Member Functions

 Time ()
 
 Time (const Time &t)
 
Timeoperator= (const Time &t)
 
 ~Time ()
 
void set (unsigned char h, unsigned char m, unsigned char s=0)
 
void set_now (void)
 
bool system_set (void)
 
unsigned char hour (void) const
 
unsigned char minute (void) const
 
unsigned char second (void) const
 
Timeoperator++ ()
 
Time operator++ (int)
 
Timeoperator-- ()
 
Time operator-- (int)
 

Static Public Member Functions

static bool is_valid (unsigned char h, unsigned char m, unsigned char s)
 

Detailed Description

A class for time manipulation.

This class allows you to manipulate with time, fetch or set one. Hour can be 0 <= hour < 24. Minutes and seconds are in 0 <= val < 60.

Note
Time where hour is 0 is always less than time where hour is 23.
Todo:
Time is missing local/UTC option.

Constructor & Destructor Documentation

Time ( )

Constructor that will set all time members to 0. This is valid time.

Time ( const Time t)

Construct time via previously declared value

~Time ( )

Destructor

Member Function Documentation

unsigned char hour ( void  ) const
inline

Returns hour

static bool is_valid ( unsigned char  h,
unsigned char  m,
unsigned char  s 
)
static

Check if given parameters can be valid time

Returns
true if time is valid
Parameters
his hour
mis minutes
sis seconds
unsigned char minute ( void  ) const
inline

Returns minutes

Time& operator++ ( )

Increase current time by one. First seconds are increased; when they reach 59, minutes are increased and seconds are set to 0. The same applies for minutes/hour case. When hour reach for 23, it is set to 0 (the same behaviour as you see from your digital clock).

Time operator++ ( int  )

Suffix increment

Time& operator-- ( )

Reverse from operator++()

Time operator-- ( int  )

Suffix decrement

Time& operator= ( const Time t)

Assign previously declared value. Current time will be replaced.

unsigned char second ( void  ) const
inline

Returns seconds

void set ( unsigned char  h,
unsigned char  m,
unsigned char  s = 0 
)

Set time values. Values should be valid time, or assertion will be triggered.

Parameters
his hour
mis minutes
sis seconds
void set_now ( void  )

Read system time and fill internal values

Todo:
This should be probably a static function
bool system_set ( void  )

Tries to set system time with current values. This function requires priviledged user. It behaves the same as Date::system_set() (see it's documentation for detail description).

Todo:
This should be probably a static function

The documentation for this class was generated from the following file: