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