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 #ifndef CSV_DATETIME_HXX 25 #define CSV_DATETIME_HXX 26 27 28 29 namespace csv 30 { 31 32 33 class Date 34 { 35 public: 36 Date(); 37 Date( 38 unsigned i_nDay, 39 unsigned i_nMonth, 40 unsigned i_nYear ); 41 Day() const42 unsigned Day() const { return nData >> 24; } Month() const43 unsigned Month() const { return (nData & 0x00FF0000) >> 16; } Year() const44 unsigned Year() const { return nData & 0x0000FFFF; } 45 46 static const Date & Null_(); 47 48 private: 49 UINT32 nData; 50 }; 51 52 class Time 53 { 54 public: 55 Time(); 56 Time( 57 unsigned i_nHour, 58 unsigned i_nMinutes, 59 unsigned i_nSeconds = 0, 60 unsigned i_nSeconds100 = 0 ); 61 Hour() const62 unsigned Hour() const { return nData >> 24; } Minutes() const63 unsigned Minutes() const { return (nData & 0x00FF0000) >> 16; } Seconds() const64 unsigned Seconds() const { return (nData & 0x0000FF00) >> 8; } Seconds100() const65 unsigned Seconds100() const { return nData & 0x000000FF; } 66 67 static const Time & Null_(); 68 69 private: 70 UINT32 nData; 71 }; 72 73 74 } // namespace csv 75 76 77 78 79 #endif 80 81