⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptime.h

📁 pwlib源码库
💻 H
📖 第 1 页 / 共 2 页
字号:
      April,      May,      June,      July,      August,      September,      October,      November,      December    };    /**Get the month of the date.       @return       enum for month.     */    Months GetMonth() const;    /**Get the year of the date.       @return       integer in range 1970..2038.     */    int GetYear() const;    /// Days of the week.    enum Weekdays {      Sunday,      Monday,      Tuesday,      Wednesday,      Thursday,      Friday,      Saturday    };    /**Get the day of the week of the date.           @return       enum for week days with 0=Sun, 1=Mon, ..., 6=Sat.     */    Weekdays GetDayOfWeek() const;    /**Get the day in the year of the date.           @return       integer from 1..366.     */    int GetDayOfYear() const;    /**Determine if the time is in the past or in the future.       @return       TRUE if time is before the current real time.     */    BOOL IsPast() const;    /**Determine if the time is in the past or in the future.       @return       TRUE if time is after the current real time.     */    BOOL IsFuture() const;  //@}  /**@name Time Zone configuration functions */  //@{    /**Get flag indicating daylight savings is current.           @return       TRUE if daylight savings time is active.     */    static BOOL IsDaylightSavings();    /// Flag for time zone adjustment on daylight savings.    enum TimeZoneType {      StandardTime,      DaylightSavings    };    /// Get the time zone offset in minutes.    static int GetTimeZone();    /**Get the time zone offset in minutes.       This is the number of minutes to add to UTC (previously known as GMT) to       get the local time. The first form automatically adjusts for daylight       savings time, whilst the second form returns the specified time.       @return       Number of minutes.     */    static int GetTimeZone(       TimeZoneType type  /// Daylight saving or standard time.    );    /**Get the text identifier for the local time zone .       @return       Time zone identifier string.     */    static PString GetTimeZoneString(       TimeZoneType type = StandardTime /// Daylight saving or standard time.    );  //@}  /**@name Operations */  //@{    /**Add the interval to the time to yield a new time.           @return       Time altered by the interval.     */    PTime operator+(      const PTimeInterval & time   /// Time interval to add to the time.    ) const;    /**Add the interval to the time changing the instance.           @return       reference to the current time instance.     */    PTime & operator+=(      const PTimeInterval & time   /// Time interval to add to the time.    );    /**Calculate the difference between two times to get a time interval.           @return       Time intervale difference between the times.     */    PTimeInterval operator-(      const PTime & time   /// Time to subtract from the time.    ) const;    /**Subtract the interval from the time to yield a new time.           @return       Time altered by the interval.     */    PTime operator-(      const PTimeInterval & time   /// Time interval to subtract from the time.    ) const;    /**Subtract the interval from the time changing the instance.       @return       reference to the current time instance.     */    PTime & operator-=(      const PTimeInterval & time   /// Time interval to subtract from the time.    );  //@}  /**@name String conversion functions */  //@{    /// Standard time formats for string representations of a time and date.    enum TimeFormat {      /// Internet standard format.      RFC1123,      /// Short form ISO standard format.      ShortISO8601,      /// Long form ISO standard format.      LongISO8601,      /// Date with weekday, full month names and time with seconds.      LongDateTime,      /// Date with weekday, full month names and no time.      LongDate,      /// Time with seconds.      LongTime,      /// Date with abbreviated month names and time without seconds.      MediumDateTime,      /// Date with abbreviated month names and no time.      MediumDate,      /// Date with numeric month name and time without seconds.      ShortDateTime,      /// Date with numeric month and no time.      ShortDate,      /// Time without seconds.      ShortTime,      NumTimeStrings    };    /** Convert the time to a string representation. */    PString AsString(      TimeFormat formatCode = RFC1123,  /// Standard format for time.      int zone = Local                  /// Time zone for the time.    ) const;    /** Convert the time to a string representation. */    PString AsString(      const PString & formatStr, /// Arbitrary format string for time.      int zone = Local           /// Time zone for the time.    ) const;    /* Convert the time to a string using the format code or string as a       formatting template. The special characters in the formatting string       are:\begin{description}       \item[h]         hour without leading zero       \item[hh]        hour with leading zero       \item[m]         minute without leading zero       \item[mm]        minute with leading zero       \item[s]         second without leading zero       \item[ss]        second with leading zero       \item[u]         tenths of second       \item[uu]        hundedths of second with leading zero       \item[uuu]       millisecond with leading zeros       \item[uuuu]      microsecond with leading zeros       \item[a]         the am/pm string       \item[w/ww/www]  abbreviated day of week name       \item[wwww]      full day of week name       \item[d]         day of month without leading zero       \item[dd]        day of month with leading zero       \item[M]         month of year without leading zero       \item[MM]        month of year with leading zero       \item[MMM]       month of year as abbreviated text       \item[MMMM]      month of year as full text       \item[y/yy]      year without century       \item[yyy/yyyy]  year with century       \item[z]         the time zone description\end{description}       All other characters are copied to the output string unchanged.              Note if there is an 'a' character in the string, the hour will be in 12       hour format, otherwise in 24 hour format.     */    PString AsString(      const char * formatPtr,    /// Arbitrary format C string pointer for time.      int zone = Local           /// Time zone for the time.    ) const;  //@}  /**@name Internationalisation functions */  //@{    /**Get the internationalised time separator.           @return       string for time separator.     */    static PString GetTimeSeparator();    /**Get the internationalised time format: AM/PM or 24 hour.           @return       TRUE is 12 hour, FALSE if 24 hour.     */    static BOOL GetTimeAMPM();    /**Get the internationalised time AM string.           @return       string for AM.     */    static PString GetTimeAM();    /**Get the internationalised time PM string.           @return       string for PM.     */    static PString GetTimePM();    /// Flag for returning language dependent string names.    enum NameType {      FullName,      Abbreviated    };    /**Get the internationalised day of week day name (0=Sun etc).           @return       string for week day.     */    static PString GetDayName(      Weekdays dayOfWeek,       /// Code for day of week.      NameType type = FullName  /// Flag for abbreviated or full name.    );    /**Get the internationalised date separator.           @return       string for date separator.     */    static PString GetDateSeparator();    /**Get the internationalised month name string (1=Jan etc).           @return       string for month.     */    static PString GetMonthName(      Months month,             /// Code for month in year.      NameType type = FullName  /// Flag for abbreviated or full name.    );    /// Possible orders for date components.    enum DateOrder {      MonthDayYear,   // Date is ordered month then day then year.      DayMonthYear,   // Date is ordered day then month then year.      YearMonthDay    // Date is ordered year then day month then day.    };    /**Return the internationalised date order.           @return       code for date ordering.     */    static DateOrder GetDateOrder();  //@}    static struct tm * os_localtime(const time_t * clock, struct tm * t);    static struct tm * os_gmtime(const time_t * clock, struct tm * t);    /*      Threadsafe version of localtime library call.      We could make these calls non-static if we could put the struct tm inside the      instance. But these calls are usually made with const objects so that's not possible,      and we would require per-thread storage otherwise. Sigh...    */  protected:    // Member variables    /// Number of seconds since 1 January 1970.    time_t theTime;    long   microseconds;// Include platform dependent part of class#ifdef _WIN32#include "msos/ptlib/ptime.h"#else#include "unix/ptlib/ptime.h"#endif};#endif// End Of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -