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 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_unotools.hxx" 26 #include <unotools/datetime.hxx> 27 #include <tools/date.hxx> 28 #include <tools/time.hxx> 29 #include <tools/datetime.hxx> 30 31 //......................................................................... 32 namespace utl 33 { 34 //......................................................................... 35 36 //------------------------------------------------------------------ 37 void typeConvert(const Time& _rTime, starutil::Time& _rOut) 38 { 39 _rOut.Hours = _rTime.GetHour(); 40 _rOut.Minutes = _rTime.GetMin(); 41 _rOut.Seconds = _rTime.GetSec(); 42 _rOut.HundredthSeconds = _rTime.Get100Sec(); 43 } 44 45 //------------------------------------------------------------------ 46 void typeConvert(const starutil::Time& _rTime, Time& _rOut) 47 { 48 _rOut = Time(_rTime.Hours, _rTime.Minutes, _rTime.Seconds, _rTime.HundredthSeconds); 49 } 50 51 //------------------------------------------------------------------ 52 void typeConvert(const Date& _rDate, starutil::Date& _rOut) 53 { 54 _rOut.Day = _rDate.GetDay(); 55 _rOut.Month = _rDate.GetMonth(); 56 _rOut.Year = _rDate.GetYear(); 57 } 58 59 //------------------------------------------------------------------ 60 void typeConvert(const starutil::Date& _rDate, Date& _rOut) 61 { 62 _rOut = Date(_rDate.Day, _rDate.Month, _rDate.Year); 63 } 64 65 //------------------------------------------------------------------ 66 void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut) 67 { 68 _rOut.Year = _rDateTime.GetYear(); 69 _rOut.Month = _rDateTime.GetMonth(); 70 _rOut.Day = _rDateTime.GetDay(); 71 _rOut.Hours = _rDateTime.GetHour(); 72 _rOut.Minutes = _rDateTime.GetMin(); 73 _rOut.Seconds = _rDateTime.GetSec(); 74 _rOut.HundredthSeconds = _rDateTime.Get100Sec(); 75 } 76 77 //------------------------------------------------------------------ 78 void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut) 79 { 80 Date aDate(_rDateTime.Day, _rDateTime.Month, _rDateTime.Year); 81 Time aTime(_rDateTime.Hours, _rDateTime.Minutes, _rDateTime.Seconds, _rDateTime.HundredthSeconds); 82 _rOut = DateTime(aDate, aTime); 83 } 84 85 //------------------------------------------------------------------------- 86 sal_Bool operator ==(const starutil::DateTime& _rLeft, const starutil::DateTime& _rRight) 87 { 88 return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) && 89 ( _rLeft.Seconds == _rRight.Seconds) && 90 ( _rLeft.Minutes == _rRight.Minutes) && 91 ( _rLeft.Hours == _rRight.Hours) && 92 ( _rLeft.Day == _rRight.Day) && 93 ( _rLeft.Month == _rRight.Month) && 94 ( _rLeft.Year == _rRight.Year) ; 95 } 96 97 //------------------------------------------------------------------------- 98 sal_Bool operator ==(const starutil::Date& _rLeft, const starutil::Date& _rRight) 99 { 100 return ( _rLeft.Day == _rRight.Day) && 101 ( _rLeft.Month == _rRight.Month) && 102 ( _rLeft.Year == _rRight.Year) ; 103 } 104 105 //------------------------------------------------------------------------- 106 sal_Bool operator ==(const starutil::Time& _rLeft, const starutil::Time& _rRight) 107 { 108 return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) && 109 ( _rLeft.Seconds == _rRight.Seconds) && 110 ( _rLeft.Minutes == _rRight.Minutes) && 111 ( _rLeft.Hours == _rRight.Hours) ; 112 } 113 114 //......................................................................... 115 } // namespace utl 116 //......................................................................... 117 118