Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsTime Class Reference

This class encapsulates full 64-bit time functionality and provides simple arithmetic and conversion operations. More...

#include <nsTime.h>

Inheritance diagram for nsTime:
Inheritance graph
[legend]
Collaboration diagram for nsTime:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsTime (void)
 Construct the current time.
 nsTime (const char *dateStr, PRBool defaultToGMT)
 Construct the time from a string.
 nsTime (const PRTime aTime)
 Construct a time from a PRTime.
 nsTime (const nsInt64 &aTime)
 Construct a time from a 64-bit value.
 nsTime (const nsTime &aTime)
 Construct a time from another time.
const nsTimeoperator= (const nsTime &aTime)
 Assign one time to another.
 operator PRTime (void) const
 Convert a nsTime object to a PRTime.
 operator PRInt32 (void) const
 Convert a 64-bit integer to a signed 32-bit value.
 operator PRUint32 (void) const
 Convert a 64-bit integer to an unsigned 32-bit value.
 operator PRFloat64 (void) const
 Convert a 64-bit integer to a floating point value.
 operator PRInt64 () const
 Convert a 64-bit integer to a native 64-bit integer.
const nsTInt64 operator- (void)
 Perform unary negation on a 64-bit integer.
const nsTInt64 operator- (const nsTInt64 &aObject2) const
 Subtract one 64-bit integer from another.
nsTInt64operator+= (const nsTInt64 &aObject)
 Increment a 64-bit integer by a 64-bit integer amount.
nsTInt64operator-= (const nsTInt64 &aObject)
 Decrement a 64-bit integer by a 64-bit integer amount.
nsTInt64operator*= (const nsTInt64 &aObject)
 Multiply a 64-bit integer by a 64-bit integer amount.
nsTInt64operator/= (const nsTInt64 &aObject)
 Divide a 64-bit integer by a 64-bit integer amount.
nsTInt64operator%= (const nsTInt64 &aObject)
 Compute the modulus of a 64-bit integer to a 64-bit value.
nsTInt64operator<<= (int aCount)
 Shift a 64-bit integer left.
nsTInt64operator>>= (int aCount)
 Shift a 64-bit signed integer right.
const nsTInt64 operator+ (const nsTInt64 &aObject2) const
 Add two 64-bit integers.
const nsTInt64 operator* (const nsTInt64 &aObject2) const
 Multiply two 64-bit integers.
const nsTInt64 operator/ (const nsTInt64 &aObject2) const
 Divide one 64-bit integer by another.
const nsTInt64 operator% (const nsTInt64 &aObject2) const
 Compute the modulus of two 64-bit integers.
const nsTInt64 operator<< (int aCount) const
 Shift left a 64-bit integer.
const nsTInt64 operator>> (int aCount) const
 Shift right a signed 64-bit integer.
PRBool operator== (const nsTInt64 &aObject2) const
 Determine if two 64-bit integers are equal.
PRBool operator== (PRInt64aValue) const
PRBool operator!= (const nsTInt64 &aObject2) const
 Determine if two 64-bit integers are not equal.
PRBool operator!= (PRInt64aValue) const
const nsTInt64 operator& (const nsTInt64 &aObject2) const
 Perform a bitwise AND of two 64-bit integers.
const nsTInt64 operator| (const nsTInt64 &aObject2) const
 Perform a bitwise OR of two 64-bit integers.
const nsTInt64 operator^ (const nsTInt64 &aObject2) const
 Perform a bitwise XOR of two 64-bit integers.
const nsTInt64 operator~ (void) const
 Compute the bitwise NOT of a 64-bit integer.
nsTInt64operator&= (const nsTInt64 &aObject)
 Compute the bitwise AND with another 64-bit integer.
nsTInt64operator|= (const nsTInt64 &aObject)
 Compute the bitwise OR with another 64-bit integer.
nsTInt64operator^= (const nsTInt64 &aObject)
 Compute the bitwise XOR with another 64-bit integer.
PRBool operator! () const
 Allow doing if (!some_nsInt64)

Public Attributes

PRInt64 mValue

Detailed Description

This class encapsulates full 64-bit time functionality and provides simple arithmetic and conversion operations.

Definition at line 54 of file nsTime.h.


Constructor & Destructor Documentation

nsTime::nsTime ( void  ) [inline]

Construct the current time.

Definition at line 60 of file nsTime.h.

                 : nsInt64(PR_Now()) {
    }
nsTime::nsTime ( const char *  dateStr,
PRBool  defaultToGMT 
) [inline]

Construct the time from a string.

Definition at line 66 of file nsTime.h.

                                                     {
        PRInt64 theTime;
        PRStatus status = PR_ParseTimeString(dateStr, defaultToGMT, &theTime);
        if (status == PR_SUCCESS)
            mValue = theTime;
        else
            mValue = LL_ZERO;
    }

Here is the call graph for this function:

nsTime::nsTime ( const PRTime  aTime) [inline]

Construct a time from a PRTime.

Definition at line 78 of file nsTime.h.

                               : nsInt64(aTime) {
    }
nsTime::nsTime ( const nsInt64 aTime) [inline]

Construct a time from a 64-bit value.

Definition at line 84 of file nsTime.h.

                                 : nsInt64(aTime) {
    }
nsTime::nsTime ( const nsTime aTime) [inline]

Construct a time from another time.

Definition at line 90 of file nsTime.h.

                                : nsInt64(aTime.mValue) {
    }

Member Function Documentation

nsTInt64< PRInt64 >::operator PRFloat64 ( void  ) const [inline, inherited]

Convert a 64-bit integer to a floating point value.

Definition at line 130 of file nsInt64.h.

                                   {
        PRFloat64 result;
        LL_L2D(result, mValue);
        return result;
    }
nsTInt64< PRInt64 >::operator PRInt32 ( void  ) const [inline, inherited]

Convert a 64-bit integer to a signed 32-bit value.

Definition at line 112 of file nsInt64.h.

                                 {
        PRInt32 result;
        LL_L2I(result, mValue);
        return result;
    }
nsTInt64< PRInt64 >::operator PRInt64 ( ) const [inline, inherited]

Convert a 64-bit integer to a native 64-bit integer.

Definition at line 139 of file nsInt64.h.

                       {
        return mValue;
    }
nsTime::operator PRTime ( void  ) const [inline]

Convert a nsTime object to a PRTime.

Definition at line 106 of file nsTime.h.

                                {
        return mValue;
    }
nsTInt64< PRInt64 >::operator PRUint32 ( void  ) const [inline, inherited]

Convert a 64-bit integer to an unsigned 32-bit value.

Definition at line 121 of file nsInt64.h.

                                  {
        PRUint32 result;
        LL_L2UI(result, mValue);
        return result;
    }
PRBool nsTInt64< PRInt64 >::operator! ( ) const [inline, inherited]

Allow doing if (!some_nsInt64)

Definition at line 356 of file nsInt64.h.

                             {
        return LL_IS_ZERO(mValue);
    }
PRBool nsTInt64< PRInt64 >::operator!= ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Determine if two 64-bit integers are not equal.

Definition at line 284 of file nsInt64.h.

                                                {
        return LL_NE(mValue, aObject2.mValue);
    }
PRBool nsTInt64< PRInt64 >::operator!= ( PRInt64  aValue) const [inline, inherited]

Definition at line 289 of file nsInt64.h.

                                {
        return LL_NE(mValue, aValue);
    }
const nsTInt64 nsTInt64< PRInt64 >::operator% ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Compute the modulus of two 64-bit integers.

Definition at line 247 of file nsInt64.h.

                                               {
        return nsTInt64(*this) %= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator%= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Compute the modulus of a 64-bit integer to a 64-bit value.

Definition at line 189 of file nsInt64.h.

                                                   {
        LL_MOD(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator& ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Perform a bitwise AND of two 64-bit integers.

Definition at line 297 of file nsInt64.h.

                                               {
        return nsTInt64(*this) &= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator&= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Compute the bitwise AND with another 64-bit integer.

Definition at line 331 of file nsInt64.h.

                                                   {
        LL_AND(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator* ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Multiply two 64-bit integers.

Definition at line 231 of file nsInt64.h.

                                               {
        return nsTInt64(*this) *= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator*= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Multiply a 64-bit integer by a 64-bit integer amount.

Definition at line 173 of file nsInt64.h.

                                                   {
        LL_MUL(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator+ ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Add two 64-bit integers.

Definition at line 215 of file nsInt64.h.

                                               {
        return nsTInt64(*this) += aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator+= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Increment a 64-bit integer by a 64-bit integer amount.

Definition at line 157 of file nsInt64.h.

                                                   {
        LL_ADD(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator- ( void  ) [inline, inherited]

Perform unary negation on a 64-bit integer.

Definition at line 146 of file nsInt64.h.

                                    {
        nsTInt64 result;
        LL_NEG(result.mValue, mValue);
        return result;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator- ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Subtract one 64-bit integer from another.

Definition at line 223 of file nsInt64.h.

                                               {
        return nsTInt64(*this) -= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator-= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Decrement a 64-bit integer by a 64-bit integer amount.

Definition at line 165 of file nsInt64.h.

                                                   {
        LL_SUB(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator/ ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Divide one 64-bit integer by another.

Definition at line 239 of file nsInt64.h.

                                               {
        return nsTInt64(*this) /= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator/= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Divide a 64-bit integer by a 64-bit integer amount.

Definition at line 181 of file nsInt64.h.

                                                   {
        LL_DIV(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator<< ( int  aCount) const [inline, inherited]

Shift left a 64-bit integer.

Definition at line 255 of file nsInt64.h.

                                  {
        return nsTInt64(*this) <<= aCount;
    }
nsTInt64& nsTInt64< PRInt64 >::operator<<= ( int  aCount) [inline, inherited]

Shift a 64-bit integer left.

Definition at line 197 of file nsInt64.h.

                                       {
        LL_SHL(mValue, mValue, aCount);
        return *this;
    }
const nsTime& nsTime::operator= ( const nsTime aTime) [inline]

Assign one time to another.

Definition at line 98 of file nsTime.h.

                                                  {
        mValue = aTime.mValue;
        return *this;
    }
PRBool nsTInt64< PRInt64 >::operator== ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Determine if two 64-bit integers are equal.

Definition at line 271 of file nsInt64.h.

                                                {
        return LL_EQ(mValue, aObject2.mValue);
    }
PRBool nsTInt64< PRInt64 >::operator== ( PRInt64  aValue) const [inline, inherited]

Definition at line 276 of file nsInt64.h.

                                {
        return LL_EQ(mValue, aValue);
    }
const nsTInt64 nsTInt64< PRInt64 >::operator>> ( int  aCount) const [inline, inherited]

Shift right a signed 64-bit integer.

Definition at line 263 of file nsInt64.h.

                                  {
        return nsTInt64(*this) >>= aCount;
    }
nsTInt64& nsTInt64< PRInt64 >::operator>>= ( int  aCount) [inline, inherited]

Shift a 64-bit signed integer right.

Definition at line 205 of file nsInt64.h.

                                       {
        LL_SHR(mValue, mValue, aCount);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator^ ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Perform a bitwise XOR of two 64-bit integers.

Definition at line 313 of file nsInt64.h.

                                               {
        return nsTInt64(*this) ^= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator^= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Compute the bitwise XOR with another 64-bit integer.

Definition at line 347 of file nsInt64.h.

                                                   {
        LL_XOR(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator| ( const nsTInt64< PRInt64 > &  aObject2) const [inline, inherited]

Perform a bitwise OR of two 64-bit integers.

Definition at line 305 of file nsInt64.h.

                                               {
        return nsTInt64(*this) |= aObject2;
    }
nsTInt64& nsTInt64< PRInt64 >::operator|= ( const nsTInt64< PRInt64 > &  aObject) [inline, inherited]

Compute the bitwise OR with another 64-bit integer.

Definition at line 339 of file nsInt64.h.

                                                   {
        LL_OR(mValue, mValue, aObject.mValue);
        return *this;
    }
const nsTInt64 nsTInt64< PRInt64 >::operator~ ( void  ) const [inline, inherited]

Compute the bitwise NOT of a 64-bit integer.

Definition at line 322 of file nsInt64.h.

                                          {
        nsTInt64 result;
        LL_NOT(result.mValue, mValue);
        return result;
    }

Member Data Documentation

PRInt64 nsTInt64< PRInt64 >::mValue [inherited]

Definition at line 57 of file nsInt64.h.


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