501 const char * formatPtr,
604 static struct tm *
os_localtime(
const time_t * clock,
struct tm * t);
605 static struct tm *
os_gmtime(
const time_t * clock,
struct tm * t);
618 static int64_t
const Micro = 1000000;
622 #include "msos/ptlib/ptime.h"
624 #include "unix/ptlib/ptime.h"
632 P_timeval(
long secs = 0,
long usecs = 0);
649 return m_infinite ? NULL : &m_timeval;
663 struct timeval m_timeval;
668 #endif // PTLIB_TIME_H
PInt64 GetTimestamp() const
Get the total microseconds since the epoch.
Time without seconds.
Definition: ptime.h:445
PString AsString(TimeFormat formatCode=RFC1123, int zone=Local) const
Convert the time to a string representation.
bool IsPast() const
Determine if the time is in the past or in the future.
int GetHour() const
Get the hour of the time.
static struct tm * os_gmtime(const time_t *clock, struct tm *t)
P_timeval(const PTimeInterval &time)
Definition: ptime.h:634
static bool GetTimeAMPM()
Get the internationalised time format: AM/PM or 24 hour.
Universal Coordinated Time.
Definition: ptime.h:61
atomic< int64_t > m_microSecondsSinceEpoch
Definition: ptime.h:617
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
int GetMinute() const
Get the minute of the time.
Date is ordered year then day month then day.
Definition: ptime.h:593
Date is ordered day then month then year.
Definition: ptime.h:592
Local Time.
Definition: ptime.h:65
NameType
Flag for returning language dependent string names.
Definition: ptime.h:557
PUInt64 GetNTP() const
Get the Network Time Protocol value.
This class defines an absolute time and date.
Definition: ptime.h:49
Date is ordered month then day then year.
Definition: ptime.h:591
time_t GetTimeInSeconds() const
Get the total seconds since the epoch.
DateOrder
Possible orders for date components.
Definition: ptime.h:590
Date with abbreviated month names and time without seconds.
Definition: ptime.h:441
PTime & operator=(const PTime &other)
PTimeInterval GetElapsed() const
Retrun time elapsed from "now".
Internet standard format. (eg. Wed, 09 Feb 2011 11:25:58 +01:00)
Definition: ptime.h:434
static PString GetDayName(Weekdays dayOfWeek, NameType type=FullName)
Get the internationalised day of week day name (0=Sun etc).
Date with weekday, full month names and time with seconds.
Definition: ptime.h:438
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
static PString GetTimeAM()
Get the internationalised time AM string.
static DateOrder GetDateOrder()
Return the internationalised date order.
PTime & operator+=(const PTimeInterval &time)
Add the interval to the time changing the instance.
static struct tm * os_localtime(const time_t *clock, struct tm *t)
TimeZoneType
Flag for time zone adjustment on daylight savings.
Definition: ptime.h:353
Months
Month codes.
Definition: ptime.h:265
static int GetTimeZone()
Get the time zone offset in minutes.
TimeFormat
Standard time formats for string representations of a time and date.
Definition: ptime.h:433
timeval * operator->()
Definition: ptime.h:652
If +/- 12 hours, only prints hh:mm:ss.uuu, otherwise LoggingFormat.
Definition: ptime.h:448
Weekdays
Days of the week.
Definition: ptime.h:296
P_timeval & operator=(const PTimeInterval &time)
Date with weekday, full month names and no time.
Definition: ptime.h:439
PTime & operator-=(const PTimeInterval &time)
Subtract the interval from the time changing the instance.
PTime()
Create a time object instance.
Definition: ptime.h:71
int GetYear() const
Get the year of the date.
Time with seconds.
Definition: ptime.h:440
Short form ISO standard format. (eg. 20110209T111108Z)
Definition: ptime.h:436
PTime & SetNTP(PUInt64 ntp)
Set the Network Time Protocol value.
Date with numeric month and no time.
Definition: ptime.h:444
bool PBoolean
Definition: object.h:174
Months GetMonth() const
Get the month of the date.
Date with abbreviated month names and no time.
Definition: ptime.h:442
bool Parse(const PString &str)
Parse a string representation of time.
The character string class.
Definition: pstring.h:108
Another Internet standard format. (eg. 2011-02-09T11:14:41ZZ)
Definition: ptime.h:435
virtual Comparison Compare(const PObject &obj) const
Determine the relative rank of the specified times.
PTimeInterval operator-(const PTime &time) const
Calculate the difference between two times to get a time interval.
Weekdays GetDayOfWeek() const
Get the day of the week of the date.
Date with numeric month name and time without seconds.
Definition: ptime.h:443
P_timeval(const PTime &time)
Definition: ptime.h:639
virtual void PrintOn(ostream &strm) const
Output the time to the stream.
PTime operator+(const PTimeInterval &time) const
Add the interval to the time to yield a new time.
PTime & AddTimestamp(int64_t usecs)
Add the time in microseconds.
virtual void ReadFrom(istream &strm)
Input the time from the specified stream.
Format used by logging. (eg. 2011/02/09 11:13:06.312)
Definition: ptime.h:447
static bool IsDaylightSavings()
Get flag indicating daylight savings is current.
Epoch format (e.g. 1234476388.123456)
Definition: ptime.h:446
int GetDay() const
Get the day of the month of the date.
static PString GetTimeSeparator()
Get the internationalised time separator.
Greenwich Mean Time, effectively UTC.
Definition: ptime.h:63
P_timeval(long secs=0, long usecs=0)
static PString GetDateSeparator()
Get the internationalised date separator.
bool IsFuture() const
Determine if the time is in the past or in the future.
int GetSecond() const
Get the second of the time.
PTime & SetTimestamp(time_t seconds, int64_t usecs=0)
Set the time in seconds and microseconds.
static int64_t const Micro
Definition: ptime.h:618
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
int GetDayOfYear() const
Get the day in the year of the date.
Long form ISO standard format. (eg. 2011-02-09T11:13:06.543Z)
Definition: ptime.h:437
static PString GetMonthName(Months month, NameType type=FullName)
Get the internationalised month name string (1=Jan etc).
unsigned GetMicrosecond() const
Get the microsecond part of the time.
PBoolean IsValid() const
Determine if the timestamp is valid.
static PString GetTimeZoneString(TimeZoneType type=StandardTime)
Get the text identifier for the local time zone .
void SetCurrentTime()
Set the the objects time with the current time in the current time zone.
static PString GetTimePM()
Get the internationalised time PM string.
timeval & operator*()
Definition: ptime.h:657
PObject * Clone() const
Create a copy of the time on the heap.
bool InternalLocalTime(struct tm &t) const