| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Private Attributes | Friends | List of all members
Gaudi::TimeSpan Class Reference

Based on seal::TimeSpan. More...

`#include <GaudiKernel/Time.h>`

Collaboration diagram for Gaudi::TimeSpan:
[legend]

## Public Types
typedef longlong | ValueType

## Public Member Functions
| TimeSpan (void)
| Initialize an empty (zero) time difference. More...
| TimeSpan (Time t)
| Initialize a time span from Time t. More...
| TimeSpan (ValueType nsecs)
| Initialize a time span to a specific length. More...
| TimeSpan (ValueType secs, int nsecs)
| Initialise a time span to a specific length. More...
| TimeSpan (int days, int hours, int mins, int secs, int nsecs)
| Initialise a time span to a specific length. More...
int | days (void) const
| Get the number of complete days in the span. More...
int | hours (void) const
| Get the number of complete hours in the span. More...
int | minutes (void) const
| Get the number of complete minutes in the span. More...
ValueType | seconds (void) const
| Get the number of complete seconds in the span. More...
int | lastHours (void) const
| Get the number of complete hours in the last incomplete day of the span. More...
int | lastMinutes (void) const
| Get the number of complete minutes in the last incomplete hour of the span. More...
int | lastSeconds (void) const
| Get the number of complete seconds in the last incomplete minute of the span. More...
int | lastNSeconds (void) const
| Get the number of nanoseconds in the last incomplete second of the span. More...
TimeSpan & | operator+= (const TimeSpan &x)
| Add to a time span. More...
TimeSpan & | operator-= (const TimeSpan &x)
| Subtract from a time span. More...
TimeSpan & | operator*= (const TimeSpan &n)
| Multiply a time span. More...
TimeSpan & | operator/= (const TimeSpan &n)
| Divide a time span. More...
TimeSpan & | operator%= (const TimeSpan &n)
| Compute a modulo of a time span. More...
ValueType | ns (void) const
| Return the time span as nanoseconds. More...

## Private Attributes
ValueType | m_nsecs

## Friends
class | Time

## Detailed Description

Based on seal::TimeSpan.

A difference between two Time values. In addition to supporting normal integer artihmetic and comparisons, the span can also be converted to a number useful units.

See also
  Time.

(Documentation taken from original SEAL class)

Author
  Marco Clemencic

Date
  2005-12-15

Definition at line 56 of file Time.h.

## Member Typedef Documentation

typedef longlong Gaudi::TimeSpan::ValueType

Definition at line 59 of file Time.h.

## Constructor & Destructor Documentation

Gaudi::TimeSpan::TimeSpan | ( | void |  | ) |
| inline

Initialize an empty (zero) time difference.

Definition at line 73 of file Time.icpp.

73 : m_nsecs(0) {}
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

Gaudi::TimeSpan::TimeSpan | ( | Time | t | ) |
| inline

Initialize a time span from Time t.

Definition at line 76 of file Time.icpp.

76 : m_nsecs (t.m_nsecs) {}
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

Gaudi::TimeSpan::TimeSpan | ( | ValueType | nsecs | ) |
| inline

Initialize a time span to a specific length.

Definition at line 79 of file Time.icpp.

79 : m_nsecs (nsecs) {}
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

Gaudi::TimeSpan::TimeSpan | ( | ValueType | secs,
|  | int | nsecs
| ) |  |
| inline

Initialise a time span to a specific length.

The value is initialised to the sum of the parts—the parts do not need to fall into their "natural" ranges. The values are normalised to the natural meanings (e.g. 1000 seconds - 500 nanoseconds), so be careful with signs if you are producing values from other sources.

Parameters

  secs | Seconds.
  nsecs | Nanoseconds.

Definition at line 89 of file Time.icpp.

90 : m_nsecs(secs * Time::SEC_NSECS + nsecs) {}
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241

Gaudi::TimeSpan::TimeSpan | ( | int | days,
|  | int | hours,
|  | int | mins,
|  | int | secs,
|  | int | nsecs
| ) |  |
| inline

Initialise a time span to a specific length.

The value is initialised to the sum of the parts—the parts do not need to fall into their "natural" ranges. The values are normalised to the natural meanings (e.g. 1000 seconds - 500 nanoseconds), so be careful with signs if you are producing values from other sources.

Parameters

  days | Whole days.
  hours | Whole hours.
  mins | Whole minutes.
  secs | Whole seconds.
  nsecs | Nanoseconds.

Definition at line 103 of file Time.icpp.

103 {
104 m_nsecs = (secs + 60 * (mins + 60 * (hours + 24*days)))*Time::SEC_NSECS + nsecs;
105 }
Gaudi::TimeSpan::days
int days(void) const
Get the number of complete days in the span.
Definition: Time.icpp:108
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241
Gaudi::TimeSpan::hours
int hours(void) const
Get the number of complete hours in the span.
Definition: Time.icpp:113

## Member Function Documentation

int Gaudi::TimeSpan::days | ( | void |  | ) | const
| inline

Get the number of complete days in the span.

Definition at line 108 of file Time.icpp.

108 {
109 return int(m_nsecs / Time::SEC_NSECS / Time::SECS_PER_DAY);
110 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241
Gaudi::Time::SECS_PER_DAY
static const int SECS_PER_DAY
Seconds in 24 hours.
Definition: Time.h:235

int Gaudi::TimeSpan::hours | ( | void |  | ) | const
| inline

Get the number of complete hours in the span.

Definition at line 113 of file Time.icpp.

113 {
114 return int(m_nsecs / Time::SEC_NSECS / Time::SECS_PER_HOUR);
115 }
Gaudi::Time::SECS_PER_HOUR
static const int SECS_PER_HOUR
Seconds in one hour hour.
Definition: Time.h:238
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241

int Gaudi::TimeSpan::lastHours | ( | void |  | ) | const
| inline

Get the number of complete hours in the last incomplete day of the span.

Definition at line 134 of file Time.icpp.

134 {
135 return hours () - days () * 24;
136 }
Gaudi::TimeSpan::days
int days(void) const
Get the number of complete days in the span.
Definition: Time.icpp:108
Gaudi::TimeSpan::hours
int hours(void) const
Get the number of complete hours in the span.
Definition: Time.icpp:113

int Gaudi::TimeSpan::lastMinutes | ( | void |  | ) | const
| inline

Get the number of complete minutes in the last incomplete hour of the span.

Definition at line 140 of file Time.icpp.

140 {
141 return minutes () - hours () * 60;
142 }
Gaudi::TimeSpan::minutes
int minutes(void) const
Get the number of complete minutes in the span.
Definition: Time.icpp:118
Gaudi::TimeSpan::hours
int hours(void) const
Get the number of complete hours in the span.
Definition: Time.icpp:113

int Gaudi::TimeSpan::lastNSeconds | ( | void |  | ) | const
| inline

Get the number of nanoseconds in the last incomplete second of the span.

Definition at line 152 of file Time.icpp.

152 {
153 return int(m_nsecs % Time::SEC_NSECS);
154 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241

int Gaudi::TimeSpan::lastSeconds | ( | void |  | ) | const
| inline

Get the number of complete seconds in the last incomplete minute of the span.

Definition at line 146 of file Time.icpp.

146 {
147 return int(seconds() - ( (ValueType)minutes() * (ValueType)60 ));
148 }
Gaudi::TimeSpan::seconds
ValueType seconds(void) const
Get the number of complete seconds in the span.
Definition: Time.icpp:123
Gaudi::TimeSpan::ValueType
longlong ValueType
Definition: Time.h:59
Gaudi::TimeSpan::minutes
int minutes(void) const
Get the number of complete minutes in the span.
Definition: Time.icpp:118

int Gaudi::TimeSpan::minutes | ( | void |  | ) | const
| inline

Get the number of complete minutes in the span.

Definition at line 118 of file Time.icpp.

118 {
119 return int(m_nsecs / Time::SEC_NSECS / 60);
120 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241

TimeSpan::ValueType Gaudi::TimeSpan::ns | ( | void |  | ) | const
| inline

Return the time span as nanoseconds.

Definition at line 128 of file Time.icpp.

128 {
129 return m_nsecs;
130 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

TimeSpan & Gaudi::TimeSpan::operator%= | ( | const TimeSpan & | x | ) |
| inline

Compute a modulo of a time span.

Definition at line 180 of file Time.icpp.

180 {
181 m_nsecs %= x.m_nsecs; return *this;
182 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

TimeSpan & Gaudi::TimeSpan::operator*= | ( | const TimeSpan & | x | ) |
| inline

Multiply a time span.

Definition at line 169 of file Time.icpp.

169 {
170 m_nsecs *= x.m_nsecs;
171 return *this;
172 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

TimeSpan & Gaudi::TimeSpan::operator+= | ( | const TimeSpan & | x | ) |
| inline

Add to a time span.

Definition at line 157 of file Time.icpp.

157 {
158 m_nsecs += x.m_nsecs;
159 return *this;
160 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

TimeSpan & Gaudi::TimeSpan::operator-= | ( | const TimeSpan & | x | ) |
| inline

Subtract from a time span.

Definition at line 163 of file Time.icpp.

163 {
164 m_nsecs -= x.m_nsecs;
165 return *this;
166 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

TimeSpan & Gaudi::TimeSpan::operator/= | ( | const TimeSpan & | x | ) |
| inline

Divide a time span.

Definition at line 175 of file Time.icpp.

175 {
176 m_nsecs /= x.m_nsecs; return *this;
177 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86

TimeSpan::ValueType Gaudi::TimeSpan::seconds | ( | void |  | ) | const
| inline

Get the number of complete seconds in the span.

Definition at line 123 of file Time.icpp.

123 {
124 return m_nsecs / Time::SEC_NSECS;
125 }
Gaudi::TimeSpan::m_nsecs
ValueType m_nsecs
Definition: Time.h:86
Gaudi::Time::SEC_NSECS
static const ValueType SEC_NSECS
Nanoseconds in one second.
Definition: Time.h:241

## Friends And Related Function Documentation

friend class Time
| friend

Definition at line 57 of file Time.h.

## Member Data Documentation

ValueType Gaudi::TimeSpan::m_nsecs
| private

Definition at line 86 of file Time.h.

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

- GaudiKernel/GaudiKernel/Time.h
- GaudiKernel/GaudiKernel/Time.icpp