summaryrefslogtreecommitdiff
path: root/tools/source/datetime
diff options
context:
space:
mode:
authorPhilipp Riemer <ruderphilipp@gmail.com>2012-08-18 18:12:35 +0200
committerPhilipp Riemer <ruderphilipp@gmail.com>2012-08-18 18:33:50 +0200
commit42352dff5a8dc4c89fccf399359876aea7dc7d2d (patch)
tree7747642c5ee1c7465e8a684a35713f5dbd90dc82 /tools/source/datetime
parent0700d6a1f3524ab79b5114559fb2d15c7ba85112 (diff)
removed ascii-art and blank lines in tools/source
Change-Id: I3f95d12a8c325c96c586253b5d9bb7dce24c0858
Diffstat (limited to 'tools/source/datetime')
-rw-r--r--tools/source/datetime/datetime.cxx92
-rw-r--r--tools/source/datetime/tdate.cxx61
-rw-r--r--tools/source/datetime/ttime.cxx41
3 files changed, 1 insertions, 193 deletions
diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx
index 151b6dc97533..c148c26273c0 100644
--- a/tools/source/datetime/datetime.cxx
+++ b/tools/source/datetime/datetime.cxx
@@ -16,17 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-
#include <tools/datetime.hxx>
#include <rtl/math.hxx>
-/*************************************************************************
-|*
-|* DateTime::IsBetween()
-|*
-*************************************************************************/
-
sal_Bool DateTime::IsBetween( const DateTime& rFrom,
const DateTime& rTo ) const
{
@@ -36,12 +28,6 @@ sal_Bool DateTime::IsBetween( const DateTime& rFrom,
return sal_False;
}
-/*************************************************************************
-|*
-|* DateTime::operator >()
-|*
-*************************************************************************/
-
sal_Bool DateTime::operator >( const DateTime& rDateTime ) const
{
if ( (Date::operator>( rDateTime )) ||
@@ -51,12 +37,6 @@ sal_Bool DateTime::operator >( const DateTime& rDateTime ) const
return sal_False;
}
-/*************************************************************************
-|*
-|* DateTime::operator <()
-|*
-*************************************************************************/
-
sal_Bool DateTime::operator <( const DateTime& rDateTime ) const
{
if ( (Date::operator<( rDateTime )) ||
@@ -66,12 +46,6 @@ sal_Bool DateTime::operator <( const DateTime& rDateTime ) const
return sal_False;
}
-/*************************************************************************
-|*
-|* DateTime::operator >=()
-|*
-*************************************************************************/
-
sal_Bool DateTime::operator >=( const DateTime& rDateTime ) const
{
if ( (Date::operator>( rDateTime )) ||
@@ -81,12 +55,6 @@ sal_Bool DateTime::operator >=( const DateTime& rDateTime ) const
return sal_False;
}
-/*************************************************************************
-|*
-|* DateTime::operator <=()
-|*
-*************************************************************************/
-
sal_Bool DateTime::operator <=( const DateTime& rDateTime ) const
{
if ( (Date::operator<( rDateTime )) ||
@@ -96,12 +64,6 @@ sal_Bool DateTime::operator <=( const DateTime& rDateTime ) const
return sal_False;
}
-/*************************************************************************
-|*
-|* DateTime::GetSecFromDateTime()
-|*
-*************************************************************************/
-
long DateTime::GetSecFromDateTime( const Date& rDate ) const
{
if ( Date::operator<( rDate ) )
@@ -117,12 +79,6 @@ long DateTime::GetSecFromDateTime( const Date& rDate ) const
}
}
-/*************************************************************************
-|*
-|* DateTime::operator +=()
-|*
-*************************************************************************/
-
DateTime& DateTime::operator +=( const Time& rTime )
{
Time aTime = *this;
@@ -152,12 +108,6 @@ DateTime& DateTime::operator +=( const Time& rTime )
return *this;
}
-/*************************************************************************
-|*
-|* DateTime::operator -=()
-|*
-*************************************************************************/
-
DateTime& DateTime::operator -=( const Time& rTime )
{
Time aTime = *this;
@@ -187,12 +137,6 @@ DateTime& DateTime::operator -=( const Time& rTime )
return *this;
}
-/*************************************************************************
-|*
-|* DateTime::operator+()
-|*
-*************************************************************************/
-
DateTime operator +( const DateTime& rDateTime, long nDays )
{
DateTime aDateTime( rDateTime );
@@ -200,12 +144,6 @@ DateTime operator +( const DateTime& rDateTime, long nDays )
return aDateTime;
}
-/*************************************************************************
-|*
-|* DateTime::operator-()
-|*
-*************************************************************************/
-
DateTime operator -( const DateTime& rDateTime, long nDays )
{
DateTime aDateTime( rDateTime );
@@ -213,12 +151,6 @@ DateTime operator -( const DateTime& rDateTime, long nDays )
return aDateTime;
}
-/*************************************************************************
-|*
-|* DateTime::operator+()
-|*
-*************************************************************************/
-
DateTime operator +( const DateTime& rDateTime, const Time& rTime )
{
DateTime aDateTime( rDateTime );
@@ -226,12 +158,6 @@ DateTime operator +( const DateTime& rDateTime, const Time& rTime )
return aDateTime;
}
-/*************************************************************************
-|*
-|* DateTime::operator-()
-|*
-*************************************************************************/
-
DateTime operator -( const DateTime& rDateTime, const Time& rTime )
{
DateTime aDateTime( rDateTime );
@@ -239,12 +165,6 @@ DateTime operator -( const DateTime& rDateTime, const Time& rTime )
return aDateTime;
}
-/*************************************************************************
-|*
-|* DateTime::operator +=( double )
-|*
-*************************************************************************/
-
DateTime& DateTime::operator +=( double fTimeInDays )
{
double fInt, fFrac;
@@ -269,12 +189,6 @@ DateTime& DateTime::operator +=( double fTimeInDays )
return *this;
}
-/*************************************************************************
-|*
-|* DateTime::operator +( double )
-|*
-*************************************************************************/
-
DateTime operator +( const DateTime& rDateTime, double fTimeInDays )
{
DateTime aDateTime( rDateTime );
@@ -282,12 +196,6 @@ DateTime operator +( const DateTime& rDateTime, double fTimeInDays )
return aDateTime;
}
-/*************************************************************************
-|*
-|* DateTime::operator -()
-|*
-*************************************************************************/
-
double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 )
{
long nDays = (const Date&) rDateTime1 - (const Date&) rDateTime2;
diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx
index 4cf41959cb24..0d4f2a35dbc9 100644
--- a/tools/source/datetime/tdate.cxx
+++ b/tools/source/datetime/tdate.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#if defined( WNT )
#include <windows.h>
#else
@@ -26,21 +25,18 @@
#include <tools/date.hxx>
#include <sal/log.hxx>
+
#ifdef MACOSX
extern "C" {
struct tm *localtime_r(const time_t *timep, struct tm *buffer);
}
#endif
-// =======================================================================
-
static sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31 };
#define MAX_DAYS 3636532
-// =======================================================================
-
inline sal_Bool ImpIsLeapYear( sal_uInt16 nYear )
{
return (
@@ -49,10 +45,7 @@ inline sal_Bool ImpIsLeapYear( sal_uInt16 nYear )
);
}
-// -----------------------------------------------------------------------
-
// All callers must have sanitized or normalized month and year values!
-
inline sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear )
{
if ( nMonth != 2 )
@@ -66,8 +59,6 @@ inline sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear )
}
}
-// -----------------------------------------------------------------------
-
long Date::DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
{
long nDays;
@@ -82,8 +73,6 @@ long Date::DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
return nDays;
}
-// -----------------------------------------------------------------------
-
static void DaysToDate( long nDays,
sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear )
{
@@ -126,8 +115,6 @@ static void DaysToDate( long nDays,
rDay = (sal_uInt16)nTempDays;
}
-// =======================================================================
-
Date::Date( DateInitSystem )
{
#if defined WNT
@@ -157,8 +144,6 @@ Date::Date( DateInitSystem )
#endif
}
-// -----------------------------------------------------------------------
-
void Date::SetDay( sal_uInt16 nNewDay )
{
sal_uIntPtr nMonth = GetMonth();
@@ -167,8 +152,6 @@ void Date::SetDay( sal_uInt16 nNewDay )
nDate = ((sal_uIntPtr)(nNewDay%100)) + (nMonth*100) + (nYear*10000);
}
-// -----------------------------------------------------------------------
-
void Date::SetMonth( sal_uInt16 nNewMonth )
{
sal_uIntPtr nDay = GetDay();
@@ -177,8 +160,6 @@ void Date::SetMonth( sal_uInt16 nNewMonth )
nDate = nDay + (((sal_uIntPtr)(nNewMonth%100))*100) + (nYear*10000);
}
-// -----------------------------------------------------------------------
-
void Date::SetYear( sal_uInt16 nNewYear )
{
sal_uIntPtr nDay = GetDay();
@@ -187,15 +168,11 @@ void Date::SetYear( sal_uInt16 nNewYear )
nDate = nDay + (nMonth*100) + (((sal_uIntPtr)(nNewYear%10000))*10000);
}
-// -----------------------------------------------------------------------
-
DayOfWeek Date::GetDayOfWeek() const
{
return (DayOfWeek)((sal_uIntPtr)(DateToDays( GetDay(), GetMonth(), GetYear() )-1) % 7);
}
-// -----------------------------------------------------------------------
-
sal_uInt16 Date::GetDayOfYear() const
{
sal_uInt16 nDay = GetDay();
@@ -208,8 +185,6 @@ sal_uInt16 Date::GetDayOfYear() const
return nDay;
}
-// -----------------------------------------------------------------------
-
sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay,
sal_Int16 nMinimumNumberOfDaysInWeek ) const
{
@@ -299,8 +274,6 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay,
return (sal_uInt16)nWeek;
}
-// -----------------------------------------------------------------------
-
sal_uInt16 Date::GetDaysInMonth() const
{
sal_uInt16 nDay = GetDay();
@@ -311,16 +284,12 @@ sal_uInt16 Date::GetDaysInMonth() const
return DaysInMonth( nMonth, nYear );
}
-// -----------------------------------------------------------------------
-
sal_Bool Date::IsLeapYear() const
{
sal_uInt16 nYear = GetYear();
return ImpIsLeapYear( nYear );
}
-// -----------------------------------------------------------------------
-
sal_Bool Date::IsValidAndGregorian() const
{
sal_uInt16 nDay = GetDay();
@@ -344,15 +313,11 @@ sal_Bool Date::IsValidAndGregorian() const
return sal_True;
}
-// -----------------------------------------------------------------------
-
bool Date::IsValidDate() const
{
return IsValidDate( GetDay(), GetMonth(), GetYear());
}
-// -----------------------------------------------------------------------
-
//static
bool Date::IsValidDate( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
{
@@ -363,8 +328,6 @@ bool Date::IsValidDate( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
return true;
}
-// -----------------------------------------------------------------------
-
bool Date::Normalize()
{
sal_uInt16 nDay = GetDay();
@@ -381,8 +344,6 @@ bool Date::Normalize()
return true;
}
-// -----------------------------------------------------------------------
-
//static
bool Date::Normalize( sal_uInt16 & rDay, sal_uInt16 & rMonth, sal_uInt16 & rYear )
{
@@ -432,8 +393,6 @@ bool Date::Normalize( sal_uInt16 & rDay, sal_uInt16 & rMonth, sal_uInt16 & rYear
return true;
}
-// -----------------------------------------------------------------------
-
Date& Date::operator +=( long nDays )
{
sal_uInt16 nDay;
@@ -455,8 +414,6 @@ Date& Date::operator +=( long nDays )
return *this;
}
-// -----------------------------------------------------------------------
-
Date& Date::operator -=( long nDays )
{
sal_uInt16 nDay;
@@ -478,8 +435,6 @@ Date& Date::operator -=( long nDays )
return *this;
}
-// -----------------------------------------------------------------------
-
Date& Date::operator ++()
{
sal_uInt16 nDay;
@@ -497,8 +452,6 @@ Date& Date::operator ++()
return *this;
}
-// -----------------------------------------------------------------------
-
Date& Date::operator --()
{
sal_uInt16 nDay;
@@ -516,9 +469,6 @@ Date& Date::operator --()
}
#ifndef MPW33
-
-// -----------------------------------------------------------------------
-
Date Date::operator ++( int )
{
Date aOldDate = *this;
@@ -526,19 +476,14 @@ Date Date::operator ++( int )
return aOldDate;
}
-// -----------------------------------------------------------------------
-
Date Date::operator --( int )
{
Date aOldDate = *this;
Date::operator--();
return aOldDate;
}
-
#endif
-// -----------------------------------------------------------------------
-
Date operator +( const Date& rDate, long nDays )
{
Date aDate( rDate );
@@ -546,8 +491,6 @@ Date operator +( const Date& rDate, long nDays )
return aDate;
}
-// -----------------------------------------------------------------------
-
Date operator -( const Date& rDate, long nDays )
{
Date aDate( rDate );
@@ -555,8 +498,6 @@ Date operator -( const Date& rDate, long nDays )
return aDate;
}
-// -----------------------------------------------------------------------
-
long operator -( const Date& rDate1, const Date& rDate2 )
{
sal_uIntPtr nTempDays1 = Date::DateToDays( rDate1.GetDay(), rDate1.GetMonth(),
diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx
index 32c5e7a84387..966771862811 100644
--- a/tools/source/datetime/ttime.cxx
+++ b/tools/source/datetime/ttime.cxx
@@ -33,8 +33,6 @@
extern long altzone;
#endif
-// =======================================================================
-
static sal_Int32 TimeToSec100( const Time& rTime )
{
short nSign = (rTime.GetTime() >= 0) ? +1 : -1;
@@ -54,8 +52,6 @@ static sal_Int32 TimeToSec100( const Time& rTime )
return (nRet * nSign);
}
-// -----------------------------------------------------------------------
-
static Time Sec100ToTime( sal_Int32 nSec100 )
{
short nSign;
@@ -72,8 +68,6 @@ static Time Sec100ToTime( sal_Int32 nSec100 )
return aTime;
}
-// =======================================================================
-
Time::Time( TimeInitSystem )
{
#if defined( WNT )
@@ -104,15 +98,11 @@ Time::Time( TimeInitSystem )
#endif
}
-// -----------------------------------------------------------------------
-
Time::Time( const Time& rTime )
{
nTime = rTime.nTime;
}
-// -----------------------------------------------------------------------
-
Time::Time( sal_uIntPtr nHour, sal_uIntPtr nMin, sal_uIntPtr nSec, sal_uIntPtr n100Sec )
{
// Zeit normalisieren
@@ -127,8 +117,6 @@ Time::Time( sal_uIntPtr nHour, sal_uIntPtr nMin, sal_uIntPtr nSec, sal_uIntPtr n
nTime = (sal_Int32)(n100Sec + (nSec*100) + (nMin*10000) + (nHour*1000000));
}
-// -----------------------------------------------------------------------
-
void Time::SetHour( sal_uInt16 nNewHour )
{
short nSign = (nTime >= 0) ? +1 : -1;
@@ -140,8 +128,6 @@ void Time::SetHour( sal_uInt16 nNewHour )
(((sal_Int32)nNewHour)*1000000)) * nSign;
}
-// -----------------------------------------------------------------------
-
void Time::SetMin( sal_uInt16 nNewMin )
{
short nSign = (nTime >= 0) ? +1 : -1;
@@ -156,8 +142,6 @@ void Time::SetMin( sal_uInt16 nNewMin )
(nHour*1000000)) * nSign;
}
-// -----------------------------------------------------------------------
-
void Time::SetSec( sal_uInt16 nNewSec )
{
short nSign = (nTime >= 0) ? +1 : -1;
@@ -172,8 +156,6 @@ void Time::SetSec( sal_uInt16 nNewSec )
(nHour*1000000)) * nSign;
}
-// -----------------------------------------------------------------------
-
void Time::Set100Sec( sal_uInt16 nNew100Sec )
{
short nSign = (nTime >= 0) ? +1 : -1;
@@ -188,8 +170,6 @@ void Time::Set100Sec( sal_uInt16 nNew100Sec )
(nHour*1000000)) * nSign;
}
-// -----------------------------------------------------------------------
-
sal_Int32 Time::GetMSFromTime() const
{
short nSign = (nTime >= 0) ? +1 : -1;
@@ -201,8 +181,6 @@ sal_Int32 Time::GetMSFromTime() const
return (((nHour*3600000)+(nMin*60000)+(nSec*1000)+(n100Sec*10))*nSign);
}
-// -----------------------------------------------------------------------
-
void Time::MakeTimeFromMS( sal_Int32 nMS )
{
short nSign;
@@ -218,8 +196,6 @@ void Time::MakeTimeFromMS( sal_Int32 nMS )
SetTime( aTime.GetTime() * nSign );
}
-// -----------------------------------------------------------------------
-
double Time::GetTimeInDays() const
{
short nSign = (nTime >= 0) ? +1 : -1;
@@ -231,16 +207,12 @@ double Time::GetTimeInDays() const
return (nHour+(nMin/60)+(nSec/(60*60))+(n100Sec/(60*60*100))) / 24 * nSign;
}
-// -----------------------------------------------------------------------
-
Time& Time::operator =( const Time& rTime )
{
nTime = rTime.nTime;
return *this;
}
-// -----------------------------------------------------------------------
-
Time& Time::operator +=( const Time& rTime )
{
nTime = Sec100ToTime( TimeToSec100( *this ) +
@@ -248,8 +220,6 @@ Time& Time::operator +=( const Time& rTime )
return *this;
}
-// -----------------------------------------------------------------------
-
Time& Time::operator -=( const Time& rTime )
{
nTime = Sec100ToTime( TimeToSec100( *this ) -
@@ -257,24 +227,18 @@ Time& Time::operator -=( const Time& rTime )
return *this;
}
-// -----------------------------------------------------------------------
-
Time operator +( const Time& rTime1, const Time& rTime2 )
{
return Sec100ToTime( TimeToSec100( rTime1 ) +
TimeToSec100( rTime2 ) );
}
-// -----------------------------------------------------------------------
-
Time operator -( const Time& rTime1, const Time& rTime2 )
{
return Sec100ToTime( TimeToSec100( rTime1 ) -
TimeToSec100( rTime2 ) );
}
-// -----------------------------------------------------------------------
-
sal_Bool Time::IsEqualIgnore100Sec( const Time& rTime ) const
{
sal_Int32 n1 = (nTime < 0 ? -Get100Sec() : Get100Sec() );
@@ -282,8 +246,6 @@ sal_Bool Time::IsEqualIgnore100Sec( const Time& rTime ) const
return (nTime - n1) == (rTime.nTime - n2);
}
-// -----------------------------------------------------------------------
-
Time Time::GetUTCOffset()
{
#if defined( WNT )
@@ -341,9 +303,6 @@ Time Time::GetUTCOffset()
#endif
}
-
-// -----------------------------------------------------------------------
-
sal_uIntPtr Time::GetSystemTicks()
{
#if defined WNT