[OPUS]

Absolute_time - A field object that represents an absolute, wall-clock time.


Availability:

This class is available for the OPUS Blackboard API. The initial OPUS 2.0 release is described here

Constructors:
Absolute_time( )
~Absolute_time( )

Methods:
long( ) converts the time value to a long representation
assign( ) overrides the base class implementation in order to validate and assign the time string to the object
clone( ) returns a copy of this object

Description

Time_entry objects contain either an Absolute_time or Delta_time field depending on which time blackboard (Absolute_time_bb or Relative_time_bb) they will be applied. Absolute_time objects encapsulate an absolute time value to which the current system time is compared whenever a Time_entry object containing this field is sent to the search method of an Absolute_time_bb object.

Objects of this type can be instantiated in three ways--

Derived from

Field

See Also:


Absolute_time::Absolute_time - The Absolute_time constructor.

Synopsis


Absolute_time::Absolute_time() : Field(Time_entry::ABS_TIME_IDENT,
                                 Absolute_time::ABS_TIME_SIZE,
                                 Time_entry::TIME_PADC)

Absolute_time::Absolute_time(
                             const time_t tm) // I - seconds since 00:00
                                              //     Jan. 1, 1970

Absolute_time::Absolute_time(
                             const string& ts) // I - string containing a
                                               //     time value of the form 
                                               //     YYYY.DDD.HH:MM:SS or
                                               //     HH:MM:SS

Absolute_time::Absolute_time(
                             const Absolute_time& abt) // I - object to
                                                       //     use as an
                                                       //     initializer

Description

These methods construct an Absolute_time object, initialized by the calling argument (if supplied). String arguments must be of the form YYYY.DDD.HH:MM:SS, or HH:MM:SS, where YYYY is the year, DDD is the day of the year [0-365], HH is the hour[0-23], MM is the minute [0-59], and SS is the second[0-61]. If no argument is supplied, the object is initialized with the current system time.

Exceptions Thrown

none

Example

  
    Absolute_time* at = new Absolute_time("12:00:00"); // place noon in
                                                       // new object
  


Absolute_time::~Absolute_time - The Absolute_time destructor.

Synopsis


Absolute_time::~Absolute_time()

Description

This method destroys the object.

Exceptions Thrown

none


Absolute_time::operator long() - Converts the internal time value to a long integer representation.

Synopsis


Absolute_time::operator long() const

Description

This method casts the internal representation of the time value into a long integer value. At present, the long will contain a time_t value (seconds since 00:00 Jan. 1, 1970). OAPI clients should not rely on the value of the long integer as the representation may change in a future release of the OAPI. Comparisons that rely on this conversion are safe.

Returns

    A long integer representation of the Absolute_time object time

value in units of seconds since 00:00 Jan. 1, 1970.

Exceptions Thrown

none


Absolute_time::assign - Set the object value to the value of the string representation.

Synopsis


void Absolute_time::assign(
                           const string& s) // I - string containing a
                                            //     time value of the form 
                                            //     YYYY.DDD.HH:MM:SS or
                                            //     HH:MM:SS

Description

This methods takes a string argument in the format YYYY.DDD.HH:MM:SS, or HH:MM:SS, where YYYY is the year, DDD is the day of the year [0-365], HH is the hour[0-23], MM is the minute [0-59], and SS is the second[0-61], and assigns it to the object.

Exceptions Thrown

Bad_val<string> - if the string is not formatted correctly; Bad_val.arg contains the calling argument


Absolute_time::clone - Create a copy of this object.

Synopsis


Field* Absolute_time::clone() const

Description

A new Absolute_time object is constructed off the heap and initialized with the contents of this object, then returned to the caller. The client should delete the new object when it is no longer needed.

Returns

    A pointer to a new Absolute_time object initialized with this object.

Exceptions Thrown

none


OPUS API index · STScI Home Page · Search · Topics · Index

Copyright © 1997-2000 The Association of Universities for Research in Astronomy, Inc. All Rights Reserved.


For more information, contact opushelp@stsci.edu

Last modified: 25 April 2000