Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

lrt::Time Class Reference

A time value. More...

#include <rtsystem.h>

List of all members.

Public Methods

 Time ()
 Creates a Time object set to 1/1/1970, 00:00:00.

 Time (int sec, int msec)
 Creates a Time object set to a custom time duration.

 Time (const String &)
 Creates a Time object by converting from the given String, which must be in the standard Unix format (as returned by toString()). More...

Time operator- (const Time &t)
 Subtracts another time from this one and returns the difference. More...

int toInt ()
 Gets the time as milliseconds. More...

String toString ()
 Converts this time (milliseconds are ignored) to the standard Unix time string. More...


Static Public Methods

Time getCurrentTime ()
 Get the current time.


Public Attributes

int sec
 Seconds since 1/1/1970, 00:00:00.

int msec
 Milliseconds in the current second.


Detailed Description

A time value.

The values should be interpreted towards the "Unix birthday" 1/1/1970 00:00:00, if they are absolute (e.g. the result of a getCurrentTime() operation), but they may also be time differences (e.g. the result of a - operation).


Constructor & Destructor Documentation

lrt::Time::Time (  const String &    ) 
 

Creates a Time object by converting from the given String, which must be in the standard Unix format (as returned by toString()).

If the string was not in correct format, the values of sec and msec will still be 0 after the construction.


Member Function Documentation

Time lrt::Time::operator- (  const Time &    t ) 
 

Subtracts another time from this one and returns the difference.

If this time is earlier than the given one, the difference will be negative.

int lrt::Time::toInt (    ) 
 

Gets the time as milliseconds.

If the time value is too large, the result is undefined. (This will always happen if this Time is an absolute time value.)

String lrt::Time::toString (    ) 
 

Converts this time (milliseconds are ignored) to the standard Unix time string.

The result looks like Mon Apr 08 15:38:42 2002.


The documentation for this class was generated from the following files:
This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer