diff options
Diffstat (limited to 'tools/inc/tools/time.hxx')
-rw-r--r-- | tools/inc/tools/time.hxx | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/tools/inc/tools/time.hxx b/tools/inc/tools/time.hxx index 6fb93f2e718c..a72fe7c587e8 100644 --- a/tools/inc/tools/time.hxx +++ b/tools/inc/tools/time.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,7 +40,7 @@ class ResId; class TOOLS_DLLPUBLIC Time { private: - sal_Int32 nTime; + sal_Int32 nTime; public: Time(); @@ -50,64 +50,64 @@ public: Time( ULONG nHour, ULONG nMin, ULONG nSec = 0, ULONG n100Sec = 0 ); - void SetTime( sal_Int32 nNewTime ) { nTime = nNewTime; } - sal_Int32 GetTime() const { return nTime; } + void SetTime( sal_Int32 nNewTime ) { nTime = nNewTime; } + sal_Int32 GetTime() const { return nTime; } - void SetHour( USHORT nNewHour ); - void SetMin( USHORT nNewMin ); - void SetSec( USHORT nNewSec ); - void Set100Sec( USHORT nNew100Sec ); - USHORT GetHour() const + void SetHour( USHORT nNewHour ); + void SetMin( USHORT nNewMin ); + void SetSec( USHORT nNewSec ); + void Set100Sec( USHORT nNew100Sec ); + USHORT GetHour() const { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1; return (USHORT)(nTempTime / 1000000); } - USHORT GetMin() const + USHORT GetMin() const { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1; return (USHORT)((nTempTime / 10000) % 100); } - USHORT GetSec() const + USHORT GetSec() const { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1; return (USHORT)((nTempTime / 100) % 100); } - USHORT Get100Sec() const + USHORT Get100Sec() const { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1; return (USHORT)(nTempTime % 100); } - sal_Int32 GetMSFromTime() const; - void MakeTimeFromMS( sal_Int32 nMS ); + sal_Int32 GetMSFromTime() const; + void MakeTimeFromMS( sal_Int32 nMS ); /// 12 hours == 0.5 days double GetTimeInDays() const; - BOOL IsBetween( const Time& rFrom, const Time& rTo ) const + BOOL IsBetween( const Time& rFrom, const Time& rTo ) const { return ((nTime >= rFrom.nTime) && (nTime <= rTo.nTime)); } BOOL IsEqualIgnore100Sec( const Time& rTime ) const; - BOOL operator ==( const Time& rTime ) const + BOOL operator ==( const Time& rTime ) const { return (nTime == rTime.nTime); } - BOOL operator !=( const Time& rTime ) const + BOOL operator !=( const Time& rTime ) const { return (nTime != rTime.nTime); } - BOOL operator >( const Time& rTime ) const + BOOL operator >( const Time& rTime ) const { return (nTime > rTime.nTime); } - BOOL operator <( const Time& rTime ) const + BOOL operator <( const Time& rTime ) const { return (nTime < rTime.nTime); } - BOOL operator >=( const Time& rTime ) const + BOOL operator >=( const Time& rTime ) const { return (nTime >= rTime.nTime); } - BOOL operator <=( const Time& rTime ) const + BOOL operator <=( const Time& rTime ) const { return (nTime <= rTime.nTime); } - static Time GetUTCOffset(); - static ULONG GetSystemTicks(); // Elapsed time - static ULONG GetProcessTicks(); // CPU time + static Time GetUTCOffset(); + static ULONG GetSystemTicks(); // Elapsed time + static ULONG GetProcessTicks(); // CPU time - void ConvertToUTC() { *this -= Time::GetUTCOffset(); } - void ConvertToLocalTime() { *this += Time::GetUTCOffset(); } + void ConvertToUTC() { *this -= Time::GetUTCOffset(); } + void ConvertToLocalTime() { *this += Time::GetUTCOffset(); } - Time& operator =( const Time& rTime ); - Time operator -() const + Time& operator =( const Time& rTime ); + Time operator -() const { return Time( nTime * -1 ); } - Time& operator +=( const Time& rTime ); - Time& operator -=( const Time& rTime ); - TOOLS_DLLPUBLIC friend Time operator +( const Time& rTime1, const Time& rTime2 ); - TOOLS_DLLPUBLIC friend Time operator -( const Time& rTime1, const Time& rTime2 ); + Time& operator +=( const Time& rTime ); + Time& operator -=( const Time& rTime ); + TOOLS_DLLPUBLIC friend Time operator +( const Time& rTime1, const Time& rTime2 ); + TOOLS_DLLPUBLIC friend Time operator -( const Time& rTime1, const Time& rTime2 ); }; #endif // _TOOLS_TIME_HXX |