earth_time::clock_time Class Reference

A specific point in time as represented by a 24 hour clock. More...

#include <earth_time.h>

Inheritance diagram for earth_time::clock_time:

Inheritance graph
[legend]
Collaboration diagram for earth_time::clock_time:

Collaboration graph
[legend]
List of all members.

Public Types

enum  time_formats {
  MERIDIAN = 0x1, MILITARY = 0x2, NO_AM_PM = 0x4, SECONDS = 0x8,
  MILLISECONDS = 0x10
}
 An enumeration of time formatting modes used when printing the time. More...

Public Member Functions

 clock_time (int h=0, int m=0, int s=0, int ms=0, int us=0)
 Constructs a clock_time object given all the parts.
virtual void pack (byte_array &packed_form) const
 Packs a clock time into an array of bytes.
virtual bool unpack (byte_array &packed_form)
 Unpacks a clock time from an array of bytes.
bool operator< (const clock_time &to_compare) const
 Returns true if this clock_time is earlier than "to_compare".
bool operator== (const clock_time &to_compare) const
 Returns true if this clock_time is equal to "to_compare".
istring text_form (int how=MERIDIAN) const
 Prints the clock_time according to "how".
void text_form (istring &to_stuff, int how=MERIDIAN) const
 Prints the time into "to_stuff" given "how".

Static Public Member Functions

static int normalize (clock_time &to_fix)

Public Attributes

int hour
 The hour represented in military time: 0 through 23.
int minute
 The number of minutes after the hour.
int second
 The number of seconds after the current minute.
int millisecond
 The number of milliseconds elapsed in this second.
int microsecond
 Number of microseconds elapsed in this millisecond.

Detailed Description

A specific point in time as represented by a 24 hour clock.

Definition at line 76 of file earth_time.h.


Member Enumeration Documentation

enum earth_time::clock_time::time_formats

An enumeration of time formatting modes used when printing the time.

Enumerator:
MERIDIAN  default: uses 12 hour with AM/PM and no seconds.
MILITARY  use military 24 hour time.
NO_AM_PM  use 12 hour time but don't include AM/PM.
SECONDS  include the number of seconds as a third field.
MILLISECONDS  milliseconds are fourth field (after secs).

Definition at line 101 of file earth_time.h.


Constructor & Destructor Documentation

earth_time::clock_time::clock_time ( int  h = 0,
int  m = 0,
int  s = 0,
int  ms = 0,
int  us = 0 
) [inline]

Constructs a clock_time object given all the parts.

Definition at line 86 of file earth_time.h.


Member Function Documentation

void earth_time::clock_time::pack ( byte_array packed_form  )  const [virtual]

Packs a clock time into an array of bytes.

Implements packable.

Reimplemented in earth_time::time_locus.

Definition at line 47 of file earth_time.cpp.

References basis::attach(), hour, microsecond, millisecond, minute, and second.

bool earth_time::clock_time::unpack ( byte_array packed_form  )  [virtual]

Unpacks a clock time from an array of bytes.

Implements packable.

Reimplemented in earth_time::time_locus.

Definition at line 56 of file earth_time.cpp.

References basis::detach(), hour, microsecond, millisecond, minute, and second.

Referenced by earth_time::time_locus::unpack().

bool earth_time::clock_time::operator< ( const clock_time to_compare  )  const

Returns true if this clock_time is earlier than "to_compare".

Definition at line 70 of file earth_time.cpp.

References EASY_LT, hour, microsecond, millisecond, minute, and second.

bool earth_time::clock_time::operator== ( const clock_time to_compare  )  const

Returns true if this clock_time is equal to "to_compare".

Definition at line 80 of file earth_time.cpp.

References hour, microsecond, millisecond, minute, and second.

istring earth_time::clock_time::text_form ( int  how = MERIDIAN  )  const

Prints the clock_time according to "how".

"how" is a combination of time_formats.

Definition at line 89 of file earth_time.cpp.

Referenced by run_test_27().

void earth_time::clock_time::text_form ( istring to_stuff,
int  how = MERIDIAN 
) const

Prints the time into "to_stuff" given "how".

note that "to_stuff" will be appended to; the existing contents are retained.

Definition at line 96 of file earth_time.cpp.

References hour, MERIDIAN, MILITARY, millisecond, MILLISECONDS, minute, second, and SECONDS.

int earth_time::clock_time::normalize ( clock_time to_fix  )  [static]

Definition at line 128 of file earth_time.cpp.

References hour, limit_value, microsecond, millisecond, minute, and second.

Referenced by earth_time::time_locus::normalize().


Member Data Documentation

int earth_time::clock_time::hour

The hour represented in military time: 0 through 23.

Definition at line 79 of file earth_time.h.

Referenced by earth_time::convert(), normalize(), operator<(), operator==(), pack(), earth_time::set_time(), text_form(), and unpack().

int earth_time::clock_time::minute

The number of minutes after the hour.

Definition at line 80 of file earth_time.h.

Referenced by earth_time::convert(), normalize(), operator<(), operator==(), pack(), earth_time::set_time(), text_form(), and unpack().

int earth_time::clock_time::second

The number of seconds after the current minute.

Definition at line 81 of file earth_time.h.

Referenced by earth_time::convert(), normalize(), operator<(), operator==(), pack(), earth_time::set_time(), text_form(), and unpack().

int earth_time::clock_time::millisecond

The number of milliseconds elapsed in this second.

Definition at line 82 of file earth_time.h.

Referenced by earth_time::convert(), normalize(), operator<(), operator==(), pack(), text_form(), and unpack().

int earth_time::clock_time::microsecond

Number of microseconds elapsed in this millisecond.

Definition at line 83 of file earth_time.h.

Referenced by earth_time::convert(), normalize(), operator<(), operator==(), pack(), and unpack().


The documentation for this class was generated from the following files:
Generated on Tue Aug 19 05:12:51 2008 for HOOPLE Libraries by  doxygen 1.5.1