unitconverter.cxx (ca5ec200) | unitconverter.cxx (f42644c3) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 176 unchanged lines hidden (view full) --- 185 return static_cast< double >( nMm100 ) / getCoefficient( eUnit ); 186} 187 188double UnitConverter::calcSerialFromDateTime( const DateTime& rDateTime ) const 189{ 190 sal_Int32 nDays = lclGetDays( Date( rDateTime.Day, rDateTime.Month, rDateTime.Year ) ) - mnNullDate; 191 OSL_ENSURE( nDays >= 0, "UnitConverter::calcDateTimeSerial - invalid date" ); 192 OSL_ENSURE( (rDateTime.Hours <= 23) && (rDateTime.Minutes <= 59) && (rDateTime.Seconds <= 59), "UnitConverter::calcDateTimeSerial - invalid time" ); | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 176 unchanged lines hidden (view full) --- 185 return static_cast< double >( nMm100 ) / getCoefficient( eUnit ); 186} 187 188double UnitConverter::calcSerialFromDateTime( const DateTime& rDateTime ) const 189{ 190 sal_Int32 nDays = lclGetDays( Date( rDateTime.Day, rDateTime.Month, rDateTime.Year ) ) - mnNullDate; 191 OSL_ENSURE( nDays >= 0, "UnitConverter::calcDateTimeSerial - invalid date" ); 192 OSL_ENSURE( (rDateTime.Hours <= 23) && (rDateTime.Minutes <= 59) && (rDateTime.Seconds <= 59), "UnitConverter::calcDateTimeSerial - invalid time" ); |
193 return nDays + rDateTime.Hours / 24.0 + rDateTime.Minutes / 1440.0 + rDateTime.Seconds / 86400.0; | 193 return nDays + rDateTime.Hours / 24.0 + rDateTime.Minutes / 1440.0 + rDateTime.Seconds / 86400.0 + rDateTime.HundredthSeconds / 8640000.0; |
194} 195 196DateTime UnitConverter::calcDateTimeFromSerial( double fSerial ) const 197{ 198 DateTime aDateTime( 0, 0, 0, 0, 1, 1, 0 ); 199 double fDays = 0.0; 200 double fTime = modf( fSerial, &fDays ); 201 --- 54 unchanged lines hidden --- | 194} 195 196DateTime UnitConverter::calcDateTimeFromSerial( double fSerial ) const 197{ 198 DateTime aDateTime( 0, 0, 0, 0, 1, 1, 0 ); 199 double fDays = 0.0; 200 double fTime = modf( fSerial, &fDays ); 201 --- 54 unchanged lines hidden --- |