Logo Search packages:      
Sourcecode: pwlib version File versions

PTime Class Reference

#include <ptime.h>

Inheritance diagram for PTime:


List of all members.

Detailed Description

This class defines an absolute time and date. It has a number of time and date rendering and manipulation functions. It is based on the standard C library functions for time. Thus it is based on a number of seconds since 1 January 1970.

Definition at line 161 of file ptime.h.


enum  { UTC = 0, GMT = UTC, Local = 9999 }
 PTime (int second, int minute, int hour, int day, int month, int year, int tz=Local)
 PTime (const PString &str)
 PTime (time_t tsecs, long usecs=0)
 PTime ()

Comparison functions

enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const

Internationalisation functions

enum  DateOrder { MonthDayYear, DayMonthYear, YearMonthDay }
 Possible orders for date components. More...
enum  NameType { FullName, Abbreviated }
 Flag for returning language dependent string names.
static DateOrder GetDateOrder ()
static PString GetDateSeparator ()
static PString GetDayName (Weekdays dayOfWeek, NameType type=FullName)
static PString GetMonthName (Months month, NameType type=FullName)
static PString GetTimeAM ()
static BOOL GetTimeAMPM ()
static PString GetTimePM ()
static PString GetTimeSeparator ()

Access functions

enum  Months {
  January = 1, February, March, April,
  May, June, July, August,
  September, October, November, December
 Month codes.
enum  Weekdays {
  Sunday, Monday, Tuesday, Wednesday,
  Thursday, Friday, Saturday
 Days of the week.
int GetDay () const
Weekdays GetDayOfWeek () const
int GetDayOfYear () const
int GetHour () const
long GetMicrosecond () const
int GetMinute () const
Months GetMonth () const
int GetSecond () const
time_t GetTimeInSeconds () const
PInt64 GetTimestamp () const
int GetYear () const
BOOL IsFuture () const
BOOL IsPast () const
BOOL IsValid () const

String conversion functions

enum  TimeFormat {
  RFC1123, ShortISO8601, LongISO8601, LongDateTime,
  LongDate, LongTime, MediumDateTime, MediumDate,
  ShortDateTime, ShortDate, ShortTime, NumTimeStrings
 Standard time formats for string representations of a time and date. More...
PString AsString (const char *formatPtr, int zone=Local) const
PString AsString (const PString &formatStr, int zone=Local) const
PString AsString (TimeFormat formatCode=RFC1123, int zone=Local) const

Time Zone configuration functions

enum  TimeZoneType { StandardTime, DaylightSavings }
 Flag for time zone adjustment on daylight savings.
static int GetTimeZone (TimeZoneType type)
static int GetTimeZone ()
 Get the time zone offset in minutes.
static PString GetTimeZoneString (TimeZoneType type=StandardTime)
static BOOL IsDaylightSavings ()

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

Public Member Functions

Overrides from class PObject
PObjectClone () const
virtual Comparison Compare (const PObject &obj) const
virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
Miscellaneous functions
virtual PINDEX HashFunction () const
PTime operator+ (const PTimeInterval &time) const
PTimeoperator+= (const PTimeInterval &time)
PTime operator- (const PTimeInterval &time) const
PTimeInterval operator- (const PTime &time) const
PTimeoperator-= (const PTimeInterval &time)

Static Public Member Functions

static struct tm * os_gmtime (const time_t *clock, struct tm *t)
static struct tm * os_localtime (const time_t *clock, struct tm *t)

Protected Attributes

long microseconds
time_t theTime
 Number of seconds since 1 January 1970.

Private Member Functions

 PCLASSINFO (PTime, PObject)


I/O functions
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index