smjg.libs.util.datetime.TimeValue Struct Reference

The smjg.libs.util.datetime.TimeValue structure represents a time within a day. More...

List of all members.

Public Types

enum  TimeInterval {
  min = 0, SECOND = 1000,
  MINUTE = SECOND * 60, HOUR = MINUTE * 60,
  DAY = HOUR * 24, max = DAY + SECOND - 1
}
 Constants representing measures of time. More...

Public Member Functions

string format (cstring formatString)
 Formats this time according to a format string.
Properties
int localMillis ()
 The time in milliseconds from midnight in local time.
int localMillis (int ms)
 The time in milliseconds from midnight in local time.
int hour ()
int minute ()
int second ()
int millisecond ()
int localDayOffset ()
 Returns the offset of the local time calendar date from the UTC date.
string toString ()
 Returns a string representation of this time.
char[] toFormatString (uint flags)
 Formats this time according to the OS-defined format.
Operators
TimeValue opAdd (int i)
 Adds the given interval in milliseconds to this time.
TimeValue opSub (int i)
 Subtracts the given interval in milliseconds from this time.
TimeInterval opSub (TimeValue d)
 Calculates the interval in milliseconds between this time and another time.
TimeValue opAddAssign (int i)
 Adds the given interval in milliseconds to this time.
TimeValue opSubAssign (int i)
 Subtracts the given interval in milliseconds from this time.

Static Public Member Functions

static TimeValue now ()
 Retrieves the current system time.
Pseudo-constructors
static TimeValue opCall (int ms)
 Constructs a TimeValue with the given UTC millisecond value.
static TimeValue opCall (int hour, int minute, int second=0, int ms=0)
 Constructs a TimeValue representing the given local time.
static TimeValue opCall (int hour, int minute, float second)
 Constructs a TimeValue representing the given local time.

Public Attributes

int utcMillis = int.min
 The internal numerical representation of the time.


Detailed Description

The smjg.libs.util.datetime.TimeValue structure represents a time within a day.


Member Enumeration Documentation

enum smjg::libs::util::datetime::TimeValue::TimeInterval

Constants representing measures of time.

Enumerator:
min  the minimum permissible time value
SECOND  a value of one second
MINUTE  a value of one minute
HOUR  a value of one hour
DAY  a value of one day
max  the maximum permissible time value. This is set to allow a leap second time value to be stored, although leap seconds are not fully supported at present.


Member Function Documentation

static TimeValue smjg.libs.util.datetime.TimeValue.opCall ( int  ms  )  [static]

Constructs a TimeValue with the given UTC millisecond value.

static TimeValue smjg.libs.util.datetime.TimeValue.opCall ( int  hour,
int  minute,
int  second = 0,
int  ms = 0 
) [static]

Constructs a TimeValue representing the given local time.

static TimeValue smjg.libs.util.datetime.TimeValue.opCall ( int  hour,
int  minute,
float  second 
) [static]

Constructs a TimeValue representing the given local time.

static TimeValue smjg.libs.util.datetime.TimeValue.now (  )  [static]

Retrieves the current system time.

Todo:
Implement on platforms other than Windows.

string smjg.libs.util.datetime.TimeValue.format ( cstring  formatString  ) 

Formats this time according to a format string.

Parameters:
formatString the format string, as defined in smjg.libs.util.datetimeformat.
Returns:
the formatted date string.
Exceptions:
DateTimeFormatException if the formatting fails, e.g. because of an error in the format string.

int smjg.libs.util.datetime.TimeValue.localMillis (  ) 

The time in milliseconds from midnight in local time.

int smjg.libs.util.datetime.TimeValue.localMillis ( int  ms  ) 

The time in milliseconds from midnight in local time.

int smjg.libs.util.datetime.TimeValue.hour (  ) 

int smjg.libs.util.datetime.TimeValue.minute (  ) 

int smjg.libs.util.datetime.TimeValue.second (  ) 

int smjg.libs.util.datetime.TimeValue.millisecond (  ) 

int smjg.libs.util.datetime.TimeValue.localDayOffset (  ) 

Returns the offset of the local time calendar date from the UTC date.

Return values:
-1 local date is the day before UTC date, e.g. 01:00 UTC when the time zone is UTC-02:00.
0 local date equals UTC date.
1 local date is the day after UTC date, e.g. 23:00 UTC when the time zone is UTC+02:00.

string smjg.libs.util.datetime.TimeValue.toString (  ) 

Returns a string representation of this time.

Returns:
a string representation of the form e.g. "22:12:31.278".

char [] smjg.libs.util.datetime.TimeValue.toFormatString ( uint  flags  ) 

Formats this time according to the OS-defined format.

Parameters:
flags a value to pass to the OS time-formatting API determining how to format the time.
Returns:
a string representation of this time in the OS-defined format.
Todo:
Implement on platforms other than Windows.

TimeValue smjg.libs.util.datetime.TimeValue.opAdd ( int  i  ) 

Adds the given interval in milliseconds to this time.

TimeValue smjg.libs.util.datetime.TimeValue.opSub ( int  i  ) 

Subtracts the given interval in milliseconds from this time.

TimeInterval smjg.libs.util.datetime.TimeValue.opSub ( TimeValue  d  ) 

Calculates the interval in milliseconds between this time and another time.

TimeValue smjg.libs.util.datetime.TimeValue.opAddAssign ( int  i  ) 

Adds the given interval in milliseconds to this time.

TimeValue smjg.libs.util.datetime.TimeValue.opSubAssign ( int  i  ) 

Subtracts the given interval in milliseconds from this time.


Member Data Documentation

int smjg.libs.util.datetime.TimeValue.utcMillis = int.min

The internal numerical representation of the time.

This value is in milliseconds from 00:00 UTC. It must be in the range 0..86401000 or be int.min, representing an invalid or null time.


The documentation for this struct was generated from the following file:
Generated on Sun Sep 13 19:50:35 2009 for Stewart's Utility Library by  doxygen 1.5.4