diff options
author | Eike Rathke <er@openoffice.org> | 2001-06-11 16:17:46 +0000 |
---|---|---|
committer | Eike Rathke <er@openoffice.org> | 2001-06-11 16:17:46 +0000 |
commit | 7cab0059da1438f4ce0534cdc1a8dd2eeeff7df9 (patch) | |
tree | 9fb24547027cbd9620f907b64847ecf5e516d012 /tools | |
parent | 7bd20730c182027a4260bf5f00cc6ab09cf18bd0 (diff) |
#87631# add: GetTimeInDays, 12 hours == 0.5 days
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/datetime/ttime.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index af1f2ef267e1..2dc5ca9c6769 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ttime.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $ + * last change: $Author: er $ $Date: 2001-06-11 17:17:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -320,6 +320,19 @@ void Time::MakeTimeFromMS( long nMS ) // ----------------------------------------------------------------------- +double Time::GetTimeInDays() const +{ + short nSign = (nTime >= 0) ? +1 : -1; + double nHour = GetHour(); + double nMin = GetMin(); + double nSec = GetSec(); + double n100Sec = Get100Sec(); + + return (nHour+(nMin/60)+(nSec/(60*60))+(n100Sec/(60*60*100))) / 24 * nSign; +} + +// ----------------------------------------------------------------------- + Time& Time::operator +=( const Time& rTime ) { nTime = Sec100ToTime( TimeToSec100( *this ) + |