1 /* 2 ** Copyright 2011-2013 Centreon 3 ** 4 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** you may not use this file except in compliance with the License. 6 ** You may obtain a copy of the License at 7 ** 8 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** 10 ** Unless required by applicable law or agreed to in writing, software 11 ** distributed under the License is distributed on an "AS IS" BASIS, 12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ** See the License for the specific language governing permissions and 14 ** limitations under the License. 15 ** 16 ** For more information : contact@centreon.com 17 */ 18 19 #include <iostream> 20 #include "com/centreon/exceptions/basic.hh" 21 #include "com/centreon/timestamp.hh" 22 23 using namespace com::centreon; 24 25 /** 26 * Check the timestamp greater operator. 27 * 28 * @return 0 on success. 29 */ main()30int main() { 31 try { 32 timestamp t1(2, 0); 33 34 timestamp t2(1, 0); 35 if (!(t1 > t2)) 36 throw(basic_error() << "operator> failed"); 37 38 timestamp t3(3, -1000); 39 if (!(t3 > t2)) 40 throw(basic_error() << "operator> failed"); 41 42 timestamp t4(1, -1); 43 if (!(t2 > t4)) 44 throw(basic_error() << "operator> failed"); 45 46 timestamp t5(-1, 0); 47 if (!(t1 > t5)) 48 throw(basic_error() << "operator> failed"); 49 } catch (std::exception const& e) { 50 std::cerr << "error: " << e.what() << std::endl; 51 return (1); 52 } 53 return (0); 54 } 55