Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MCTime Class Reference

Utility class to help manage times. More...

#include <mcllib/MCTime.h>

List of all members.

Public Member Functions

 MCTime (mctime_t t)
 Construct from an mctime_t value.
 MCTime (const char *timeStr)
 Construct from a time string.
 MCTime ()
 Create a time representing the current time.
 operator mctime_t () const
 Get the mctime_t value from the time object.
bool operator!= (const MCTime &t) const
 Compare two time objects for in-equality.
MCTime operator() (const MCTimeDelta &t) const
 Apply a delta to this MCTime.
MCTimeDelta operator- (const MCTime &t) const
 Subtract an MCTime from this time object.
bool operator< (const MCTime &t) const
 Determine if this MCTime object is less than another.
bool operator<= (const MCTime &t) const
 Determine if this MCTime object is less or equal to another.
MCTimeoperator= (mctime_t t)
 Assign from an mctime_t.
bool operator== (const MCTime &t) const
 Compare two time objects for equality.
bool operator> (const MCTime &t) const
 Determine if this MCTime object is greater than another.
bool operator>= (const MCTime &t) const
 Determine if this MCTime object is greater than or equal to another.
MCString toString () const
 Get the time as a string in the default format.


Detailed Description

Utility class to help manage times.

Times are represented in microseconds since 00:00 1st Jan 1970


Constructor & Destructor Documentation

MCTime const char *  timeStr  ) 
 

Construct from a time string.

Many formats are handled including

  • 14 Apr 89 03:20:12
  • 14 Apr 89 03:20 GMT
  • Fri, 17 Mar 89 4:01:33
  • Fri, 17 Mar 89 4:01 GMT
  • Mon Jan 16 16:12 PDT 1989
  • Mon Jan 16 16:12 +0130 1989
  • 6 May 1992 16:41-JST (Wednesday)
  • 22-AUG-1993 10:59:12.82
  • 22-AUG-1993 10:59pm
  • 22-AUG-1993 12:59am
  • 22-AUG-1993 12:59 PM
  • Friday, August 04, 1995 3:54 PM
  • 06/21/95 04:24:34 PM
  • 20/06/95 21:07
  • 95-06-08 19:32:48 EDT
    Parameters:
    timeStr the time string specification to parse

MCTime mctime_t  t  )  [explicit]
 

Construct from an mctime_t value.

Parameters:
t the mctime_t value to use


Member Function Documentation

operator mctime_t  )  const
 

Get the mctime_t value from the time object.

Returns:
an mctime_t value for the current time.

bool operator!= const MCTime t  )  const
 

Compare two time objects for in-equality.

Parameters:
t MCTime to compare against this time object
Returns:
true if this MCTime != t

MCTime operator() const MCTimeDelta t  )  const
 

Apply a delta to this MCTime.

Because the delta may be positive or negative, the value of this MCTime is increased or decreased accordingly.

Parameters:
t the delta to apply (add or subtract)
Returns:
a new MCTime which is the result of the operation.

MCTimeDelta operator- const MCTime t  )  const
 

Subtract an MCTime from this time object.

Parameters:
t MCTime to subtract from this time object
Returns:
a MCTimeDelta which is the difference between the two objects

bool operator< const MCTime t  )  const
 

Determine if this MCTime object is less than another.

Parameters:
t MCTime to compare against this time object
Returns:
true if this MCTime < t

bool operator<= const MCTime t  )  const
 

Determine if this MCTime object is less or equal to another.

Parameters:
t MCTime to compare against this time object
Returns:
true if this MCTime <= t

MCTime& operator= mctime_t  t  ) 
 

Assign from an mctime_t.

Parameters:
t the mctime_t value to assign
Returns:
reference to this MCTime object

bool operator== const MCTime t  )  const
 

Compare two time objects for equality.

Parameters:
t MCTime to compare against this time object
Returns:
true if this MCTime == t

bool operator> const MCTime t  )  const
 

Determine if this MCTime object is greater than another.

Parameters:
t MCTime to compare against this time object
Returns:
true if this MCTime > t

bool operator>= const MCTime t  )  const
 

Determine if this MCTime object is greater than or equal to another.

Parameters:
t MCTime to compare against this time object
Returns:
true if this MCTime >= t

MCString toString  )  const
 

Get the time as a string in the default format.

The default format is YYYY-MM-DD HH:mm:SS.ttt<P> Where

  • YYYY is the year including century
  • MM is the month (01 is January)
  • DD is the day of the month
  • HH is the hour
  • mm is the minute
  • SS is the second
  • ttt is thousandths of a second
    Returns:
    a string representing the time object


Generated on Wed Jan 12 19:05:50 2005 for MCLLIB by  doxygen 1.3.9.1