Time Class Reference

A class for time manipulation. More...

#include <edelib/DateTime.h>

List of all members.

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:
h is hour
m is minutes
s is seconds

unsigned char minute ( void   )  const [inline]

Returns minutes

Time operator++ ( int   ) 

Suffix increment

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 decrement

Time& operator-- (  ) 

Reverse from operator++()

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:
h is hour
m is minutes
s is 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:

Generated on Thu Dec 24 05:12:27 2009 for edelib by  doxygen 1.5.9