Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTime (deprecated)

Module:  Essential Tools Module   Group:  Date and Time Classes


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/rwtime.h>
RWTime a;   // Construct with current time

Description


NOTE -- RWTime is deprecated and is no longer supported. Be aware that it may be removed in a future release. Please use RWDateTime instead. RWDateTime combines the functionality of RWDate and RWTime, but with a much greater range and millisecond accuracy.

Class RWTime represents a time, stored as the number of seconds since 00:00:00 January 1, 1901 GMT. The User's Guide chapter on date and time classes describes how to set the time zone for your compiler. Failure to do this may result in GMT times being wrong.


NOTE -- RWTime is unable to store times prior to 00:00:00 1 Jan 1901.

Output formatting is done using an RWLocale object. The default locale formats according to U.S. conventions.

Note that because the default constructor for this class creates an instance holding the current date and time, constructing a large array of RWTime may be slow.

Those with access to the C++ Standard Library-based versions of the Essential Tools Module template collections should consider the following:

Thanks to the smart allocation scheme of the standard collections, the above declaration will result in only one call to the default constructor followed by 5000 invocations of the copy constructor. In the case of RWTime, the copy constructor amounts to an assignment of one long to another, resulting in faster creation than the simple array.

Persistence

Simple

Example

This example constructs a current time, and the time when Daylight Saving Time starts in the year 1990. It then prints them out.

Program output

Public Constructors

RWTime();
RWTime(const RWTime&);
RWTime(unsigned long s);
RWTime(unsigned hour, unsigned minute, unsigned second=0,
       const RWZone& zone = RWZone::local());
RWTime(const RWDate& date, unsigned hour = 0, 
       unsigned minute = 0,unsigned second = 0, 
       const RWZone& = RWZone::local());
RWTime(const struct tm*, const RWZone& = RWZone::local());
RWTime(const RWDate& date, const RWCString& str,
       const RWZone& zone = RWZone::local(),
       const RWLocale& locale = RWLocale::global());

Public Member Operators

RWTime&
operator=(const RWTime&);
RWTime
operator++();
RWTime
operator--();
RWTime
operator++(int);
RWTime
operator--(int);
RWTime&
operator+=(unsigned long s);
RWTime&
operator-=(unsigned long s);

Public Member Functions

RWCString
asString(char format = '\0',const RWZone& =
         RWZone::local(),
         const RWLocale& = RWLocale::global()) const;
RWCString
asString(char* format,const RWZone&   = RWZone::local(),
         const RWLocale& = RWLocale::global()) const;
bool
between(const RWTime& a, const RWTime& b) const;
size_t
binaryStoreSize() const;
int
compareTo(const RWTime* t) const;
void
extract(struct tm*,const RWZone& = RWZone::local()) const;
unsigned
hash() const;
unsigned
hour(const RWZone& zone = RWZone::local()) const;
unsigned
hourGMT() const;
bool
isDST(const RWZone& zone = RWZone::local()) const;
bool
isValid() const;
RWTime
max(const RWTime& t) const;
RWTime
min(const RWTime& t) const;
unsigned
minute(const RWZone& zone = RWZone::local()) const;
unsigned
minuteGMT() const;
unsigned
second() const;
unsigned long
seconds() const;

Static Public Member Functions

static RWTime
beginDST(unsigned year,
         const RWZone& zone = RWZone::local());
static RWTime
endDST(unsigned year, const RWZone& = RWZone::local());
static unsigned
hash(const RWTime& t);
static RWTime
now();

Related Global Operators

RWTime
operator+(const RWTime& t, unsigned long s);
RWTime
operator+(unsigned long s, const RWTime& t);
RWTime
operator-(const RWTime& t, unsigned long s);
bool
operator<(const RWTime& t1, const RWTime& t2);
bool
operator<=(const RWTime& t1, const RWTime& t2);
bool
operator>(const RWTime& t1, const RWTime& t2);
bool
operator>=(const RWTime& t1, const RWTime& t2);
bool
operator==(const RWTime& t1, const RWTime& t2);
bool
operator!= (const RWTime& t1, const RWTime& t2);
ostream&
operator<<(ostream& s, const RWTime& t);
istream&
operator>>(istream&, RWTime&);
RWvostream&
operator<<(RWvostream&, const RWTime& t);
RWFile&
operator<<(RWFile&,     const RWTime& t);
RWvistream&
operator>>(RWvistream&, RWTime& t);
RWFile&
operator>>(RWFile&,     RWTime& t);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.