Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::DateTimeSpan Class Reference

The DateTimeSpan represents an absolute delta value between two date time values. More...

#include <vcf/FoundationKit/DateTime.h>

List of all members.

Public Member Functions

 DateTimeSpan ()
 DateTimeSpan (uint64 delta)
 Constructs a new time span that begins from now.
 DateTimeSpan (const DateTimeSpan &rhs)
DateTimeSpanoperator= (const DateTimeSpan &rhs)
 operator uint64 () const
 allows conversion to a uint64 ( POD ) data type
uint32 getYears () const
 returns the number of years in this span of time
uint32 getMonths () const
 returns the number of months in this span of time
uint32 getDays () const
 returns the number of days in this span of time
uint32 getHours () const
 returns the number of hours in this span of time
uint32 getMinutes () const
 returns the number of minutes in this span of time
uint32 getSeconds () const
 returns the number of seconds in this span of time
uint32 getMilliseconds () const
 returns the number of milliseconds in this span of time
uint32 getTotalMonths () const
 returns the total number of whole months if this span of time is evaluated in months as the unit of measurement
uint32 getTotalDays () const
 returns the total number of whole days if this span of time is evaluated in days as the unit of measurement
uint32 getTotalHours () const
 returns the total number of whole hours if this span of time is evaluated in hours as the unit of measurement
uint32 getTotalMinutes () const
 returns the total number of whole minutes if this span of time is evaluated in minutes as the unit of measurement
uint32 getTotalSeconds () const
 returns the total number of whole seconds if this span of time is evaluated in seconds as the unit of measurement
uint64 getTotalMilliseconds () const
 returns the total number of whole milliseconds if this span of time is evaluated in milliseconds as the unit of measurement

Protected Member Functions

void subtract (const DateTime &lhs, const DateTime &rhs)
DateTimeSpanoperator= (const uint64 &rhs)

Protected Attributes

uint64 delta_
uint64 start_
uint64 end_
uint32 years_
uint32 months_
uint32 days_

Friends

class DateTime


Detailed Description

The DateTimeSpan represents an absolute delta value between two date time values.

You can get the individual components of the span by calling the various getYears(), getMonths(), etc methods, or you can get the total amount of time this span covers in a particular format, such the total minutes, or the total seconds. An example of this might look like so:

DateTime dt1(2003,2,10); //2003, Feb 10th
DateTime dt2(2003,2,23); //2003, Feb 23rd
DateTimeSpan span = dt1 - dt2;
int totalHours = span.getTotalHours();//returns 312 (or 24 * 13)
int totalMinutes = span.getTotalMinutes(); //returns 18,720 (or 60 * 24 * 13)

int days = span.getDays(); //returns 13
int months = span.getMonths(); //returns 0
int minutes = span.getMinutes(); //returns 0


Constructor & Destructor Documentation

VCF::DateTimeSpan::DateTimeSpan  )  [inline]
 

VCF::DateTimeSpan::DateTimeSpan uint64  delta  )  [inline]
 

Constructs a new time span that begins from now.

The given delta determines how long should be the constructed span.

Parameters:
uint64 the milliseconds.

VCF::DateTimeSpan::DateTimeSpan const DateTimeSpan rhs  )  [inline]
 


Member Function Documentation

uint32 VCF::DateTimeSpan::getDays  )  const
 

returns the number of days in this span of time

uint32 VCF::DateTimeSpan::getHours  )  const
 

returns the number of hours in this span of time

uint32 VCF::DateTimeSpan::getMilliseconds  )  const
 

returns the number of milliseconds in this span of time

uint32 VCF::DateTimeSpan::getMinutes  )  const
 

returns the number of minutes in this span of time

uint32 VCF::DateTimeSpan::getMonths  )  const
 

returns the number of months in this span of time

uint32 VCF::DateTimeSpan::getSeconds  )  const
 

returns the number of seconds in this span of time

uint32 VCF::DateTimeSpan::getTotalDays  )  const
 

returns the total number of whole days if this span of time is evaluated in days as the unit of measurement

uint32 VCF::DateTimeSpan::getTotalHours  )  const
 

returns the total number of whole hours if this span of time is evaluated in hours as the unit of measurement

uint64 VCF::DateTimeSpan::getTotalMilliseconds  )  const
 

returns the total number of whole milliseconds if this span of time is evaluated in milliseconds as the unit of measurement

uint32 VCF::DateTimeSpan::getTotalMinutes  )  const
 

returns the total number of whole minutes if this span of time is evaluated in minutes as the unit of measurement

uint32 VCF::DateTimeSpan::getTotalMonths  )  const
 

returns the total number of whole months if this span of time is evaluated in months as the unit of measurement

uint32 VCF::DateTimeSpan::getTotalSeconds  )  const
 

returns the total number of whole seconds if this span of time is evaluated in seconds as the unit of measurement

uint32 VCF::DateTimeSpan::getYears  )  const
 

returns the number of years in this span of time

VCF::DateTimeSpan::operator uint64  )  const [inline]
 

allows conversion to a uint64 ( POD ) data type

DateTimeSpan& VCF::DateTimeSpan::operator= const uint64 rhs  )  [inline, protected]
 

DateTimeSpan& VCF::DateTimeSpan::operator= const DateTimeSpan rhs  )  [inline]
 

void VCF::DateTimeSpan::subtract const DateTime lhs,
const DateTime rhs
[protected]
 


Friends And Related Function Documentation

friend class DateTime [friend]
 


Member Data Documentation

uint32 VCF::DateTimeSpan::days_ [protected]
 

uint64 VCF::DateTimeSpan::delta_ [protected]
 

uint64 VCF::DateTimeSpan::end_ [protected]
 

uint32 VCF::DateTimeSpan::months_ [protected]
 

uint64 VCF::DateTimeSpan::start_ [protected]
 

uint32 VCF::DateTimeSpan::years_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information