Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

Static Public Member Functions | Protected Attributes | Private Member Functions

PTime Class Reference

#include <ptime.h>

Inheritance diagram for PTime:
Inheritance graph
Collaboration diagram for PTime:
Collaboration graph

List of all members.

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)
PTime operator+ (const PTimeInterval &time) const
PTimeoperator+= (const PTimeInterval &time)
PTimeInterval operator- (const PTime &time) const
PTime operator- (const PTimeInterval &time) const
PTimeoperator-= (const PTimeInterval &time)
Miscellaneous functions
virtual PINDEX HashFunction () const

Static Public Member Functions

static struct tmos_gmtime (const time_t *clock, struct tm *t)
static struct tmos_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)


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

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.

BOOL IsValid () const
PInt64 GetTimestamp () const
time_t GetTimeInSeconds () const
long GetMicrosecond () const
int GetSecond () const
int GetMinute () const
int GetHour () const
int GetDay () const
Months GetMonth () const
int GetYear () const
Weekdays GetDayOfWeek () const
int GetDayOfYear () const
BOOL IsPast () const
BOOL IsFuture () const

Time Zone configuration functions

enum  TimeZoneType { StandardTime, DaylightSavings }

Flag for time zone adjustment on daylight savings.

static BOOL IsDaylightSavings ()
static int GetTimeZone ()
 Get the time zone offset in minutes.
static int GetTimeZone (TimeZoneType type)
static PString GetTimeZoneString (TimeZoneType type=StandardTime)

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.

PString AsString (TimeFormat formatCode=RFC1123, int zone=Local) const
PString AsString (const PString &formatStr, int zone=Local) const
PString AsString (const char *formatPtr, int zone=Local) const

Internationalisation functions

enum  NameType { FullName, Abbreviated }

Flag for returning language dependent string names.

enum  DateOrder { MonthDayYear, DayMonthYear, YearMonthDay }

Possible orders for date components.

static PString GetTimeSeparator ()
static BOOL GetTimeAMPM ()
static PString GetTimeAM ()
static PString GetTimePM ()
static PString GetDayName (Weekdays dayOfWeek, NameType type=FullName)
static PString GetDateSeparator ()
static PString GetMonthName (Months month, NameType type=FullName)
static DateOrder GetDateOrder ()

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

Run Time Type functions

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

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.

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

Generated by  Doxygen 1.6.0   Back to index