class Time

A time holding class. More...

Full nameTelEngine::Time
Definition#include <yateclass.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

The Time class holds a time moment with microsecond accuracy

inline  Time ()

Time

Constructs a Time object from the current time

inline  Time (u_int64_t usec)

Time

Constructs a Time object from a given time

Parameters:
usecTime in microseconds

inline explicit  Time (const struct timeval* tv)

Time

Constructs a Time object from a timeval structure pointer

Parameters:
tvPointer to the timeval structure

inline explicit  Time (const struct timeval& tv)

Time

Constructs a Time object from a timeval structure

Parameters:
tvReference of the timeval structure

inline  ~Time ()

~Time

Do-nothing destructor that keeps the compiler from complaining about inlining derivates or members of Time type

inline u_int32_t  sec ()

sec

[const]

Get time in seconds

Returns: Time in seconds since the Epoch

inline u_int64_t  msec ()

msec

[const]

Get time in milliseconds

Returns: Time in milliseconds since the Epoch

inline u_int64_t  usec ()

usec

[const]

Get time in microseconds

Returns: Time in microseconds since the Epoch

inline operator  u_int64_t ()

u_int64_t

[const]

Conversion to microseconds operator

inline Time&  operator= (u_int64_t usec)

operator=

Assignment operator.

inline Time&  operator+= (int64_t delta)

operator+=

Offsetting operator.

inline Time&  operator-= (int64_t delta)

operator-=

Offsetting operator.

inline void  toTimeval (struct timeval* tv)

toTimeval

[const]

Fill in a timeval struct from a value in microseconds

Parameters:
tvPointer to the timeval structure

void  toTimeval (struct timeval* tv, u_int64_t usec)

toTimeval

[static]

Fill in a timeval struct from a value in microseconds

Parameters:
tvPointer to the timeval structure
usecTime to convert to timeval

u_int64_t  fromTimeval (const struct timeval* tv)

fromTimeval

[static]

Convert time in a timeval struct to microseconds

Parameters:
tvPointer to the timeval structure

Returns: Corresponding time in microseconds or zero if tv is NULL

inline u_int64_t  fromTimeval (const struct timeval& tv)

fromTimeval

[static]

Convert time in a timeval struct to microseconds

Parameters:
tvReference of the timeval structure

Returns: Corresponding time in microseconds

u_int64_t  now ()

now

[static]

Get the current system time in microseconds

Returns: Time in microseconds since the Epoch

u_int64_t  msecNow ()

msecNow

[static]

Get the current system time in milliseconds

Returns: Time in milliseconds since the Epoch

u_int32_t  secNow ()

secNow

[static]

Get the current system time in seconds

Returns: Time in seconds since the Epoch

unsigned int  toEpoch (int year, unsigned int month, unsigned int day, unsigned int hour, unsigned int minute, unsigned int sec, int offset = 0)

toEpoch

[static]

Build EPOCH time from date/time components

Parameters:
yearThe year component of the date. Must be greater then 1969
monthThe month component of the date (1 to 12)
dayThe day component of the date (1 to 31)
hourThe hour component of the time (0 to 23). The hour can be 24 if minute and sec are 0
minuteThe minute component of the time (0 to 59)
secThe seconds component of the time (0 to 59)
offsetOptional number of seconds to be added/substracted to/from result. It can't exceed the number of seconds in a day

Returns: EPOCH time in seconds, -1 on failure

bool  toDateTime (unsigned int epochTimeSec, int& year, unsigned int& month, unsigned int& day, unsigned int& hour, unsigned int& minute, unsigned int& sec)

toDateTime

[static]

Split a given EPOCH time into its date/time components

Parameters:
epochTimeSecEPOCH time in seconds
yearThe year component of the date
monthThe month component of the date (1 to 12)
dayThe day component of the date (1 to 31)
hourThe hour component of the time (0 to 23)
minuteThe minute component of the time (0 to 59)
secThe seconds component of the time (0 to 59)

Returns: True on succes, false if conversion failed

inline bool  isLeap (unsigned int year)

isLeap

[static]

Check if an year is a leap one

Parameters:
yearThe year to check

Returns: True if the given year is a leap one


Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.