MityDSP Documentation Index
Public Member Functions | Static Public Attributes | Protected Attributes
MityDSP::tcDspRtcBase Class Reference

The tcDspRtcBase class is a virtual base class to provide consistent access to various real-time clock devices. More...

#include <core/DspRtcBase.h>

Inheritance diagram for MityDSP::tcDspRtcBase:
MityDSP::tcDspRtcDS1305 MityDSP::tcDspRtcM41T81

List of all members.

Public Member Functions

 tcDspRtcBase (unsigned int anEpochYear=Y2K)
 This constructor is used to initialize the real-time clock base class.
virtual ~tcDspRtcBase ()
 Default Destructor.
virtual tsCLTime get_time (unsigned short *apHundredths=NULL)=0
virtual void set_time (tsCLTime asTime)=0
virtual void set_time (unsigned int anYear, unsigned int anMonth, unsigned int anDay, unsigned int anHour, unsigned int anMin, unsigned int anSec)=0
void convert_time (unsigned int anYear, unsigned int anMonth, unsigned int anDay, unsigned int anHour, unsigned int anMin, unsigned int anSec, tsCLTime &arTime)
 This routine converts from discrete year, month, day, hours, minutes and seconds to a tsCLTime value.
void convert_time (tsCLTime asTime, unsigned int &arYear, unsigned int &arMonth, unsigned int &arDay, unsigned int &arHour, unsigned int &arMin, unsigned int &arSec)
 This routine converts from a tsCLTime value to discrete year, month, day, hours, minutes and seconds.
unsigned int convert_time (tsCLTime asTime)
 This routine converts from a tsCLTime value to a number of seconds since the start of the current epoch.
tsCLTime convert_time (unsigned int anSecsSinceEpoch)
 This routine converts from the number of seconds since the start of the current epoch to a tsCLTime value.
bool isLeapYear (unsigned int anYear)
 This routine determines if the specified year is a leap year.

Static Public Attributes

static const int gaMonthdays [13]
static const int gnDaysPerYear = 365
static const int gnHoursPerDay = 24
static const int gnSecsPerHour = 3600

Protected Attributes

SEM_Handle mhMutex
 Used to serialize access.
unsigned int mnEpoch
 Epoch year used in CL-Time structure.

Detailed Description

The tcDspRtcBase class is a virtual base class to provide consistent access to various real-time clock devices.

It provides functions for converting time formats, as well as getting and setting the current time.

See also:
tcDspRtcBase Page

Constructor & Destructor Documentation

tcDspRtcBase::tcDspRtcBase ( unsigned int  anYear = Y2K)

This constructor is used to initialize the real-time clock base class.

Parameters:
[in]anYearBase year (epoch) for this real-time clock.
tcDspRtcBase::~tcDspRtcBase ( )
virtual

Default Destructor.


Member Function Documentation

virtual tsCLTime MityDSP::tcDspRtcBase::get_time ( unsigned short *  apHundredths = NULL)
pure virtual
virtual void MityDSP::tcDspRtcBase::set_time ( tsCLTime  asTime)
pure virtual
virtual void MityDSP::tcDspRtcBase::set_time ( unsigned int  anYear,
unsigned int  anMonth,
unsigned int  anDay,
unsigned int  anHour,
unsigned int  anMin,
unsigned int  anSec 
)
pure virtual
void tcDspRtcBase::convert_time ( unsigned int  anYear,
unsigned int  anMonth,
unsigned int  anDay,
unsigned int  anHour,
unsigned int  anMin,
unsigned int  anSec,
tsCLTime arTime 
)

This routine converts from discrete year, month, day, hours, minutes and seconds to a tsCLTime value.

Parameters:
[in]anYearCurrent year.
[in]anMonthCurrent month (1-12).
[in]anDayCurrent day (1-31).
[in]anHourCurrent hour in 24-hour time (0-23).
[in]anMinCurrent Minute (0-59).
[in]anSecCurrent Seconds (0-59).
[out]arTimeReference to a tsCLTime struct.
void tcDspRtcBase::convert_time ( tsCLTime  asTime,
unsigned int &  arYear,
unsigned int &  arMonth,
unsigned int &  arDay,
unsigned int &  arHour,
unsigned int &  arMin,
unsigned int &  arSec 
)

This routine converts from a tsCLTime value to discrete year, month, day, hours, minutes and seconds.

Parameters:
[in]asTimea tsCLTime structure to convert.
[out]arYearCurrent year.
[out]arMonthCurrent month (1-12).
[out]arDayCurrent day (1-31).
[out]arHourCurrent hour in 24-hour time (0-23).
[out]arMinCurrent Minute (0-59).
[out]arSecCurrent Seconds (0-59).
unsigned int tcDspRtcBase::convert_time ( tsCLTime  asTime)

This routine converts from a tsCLTime value to a number of seconds since the start of the current epoch.

Parameters:
[in]asTimea tsCLTime structure to convert.
Returns:
Seconds since midnight on January 1 of the Epoch year.
tsCLTime tcDspRtcBase::convert_time ( unsigned int  anSecsSinceEpoch)

This routine converts from the number of seconds since the start of the current epoch to a tsCLTime value.

Parameters:
[in]anSecsSinceEpochSeconds since start of the Epoch year.
Returns:
The resulting tsCLTime structure.
bool tcDspRtcBase::isLeapYear ( unsigned int  anYear)

This routine determines if the specified year is a leap year.

Parameters:
[in]anYearThe year to test.
Returns:
True if the year is a leap year.

Member Data Documentation

const int tcDspRtcBase::gaMonthdays
static
Initial value:
{ 0, 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31 }
const int tcDspRtcBase::gnDaysPerYear = 365
static
const int tcDspRtcBase::gnHoursPerDay = 24
static
const int tcDspRtcBase::gnSecsPerHour = 3600
static
SEM_Handle MityDSP::tcDspRtcBase::mhMutex
protected

Used to serialize access.

unsigned int MityDSP::tcDspRtcBase::mnEpoch
protected

Epoch year used in CL-Time structure.


  
Generated on Mon Apr 22 2013 11:33:04 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.