Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * qa_time.cpp - QA app for watch, clock, timesoure, ... 00004 * 00005 * Generated: Sun June 03 22:33:22 2007 00006 * Copyright 2007 Daniel Beck 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <utils/time/clock.h> 00025 #include <utils/time/watch.h> 00026 00027 #include <unistd.h> 00028 00029 #include <iostream> 00030 00031 using namespace std; 00032 using namespace fawkes; 00033 00034 int main(int argc, char** argv) 00035 { 00036 Clock *clock = Clock::instance(); 00037 00038 Watch watch(clock); 00039 Time time(clock); 00040 00041 time = watch.clock_time(); 00042 cout << "Current clock time is " << time.str() << endl; 00043 00044 watch.start(&time); 00045 cout << "Starting watch at " << time.str() << endl; 00046 sleep(1); 00047 00048 cout << "Watch is running for " << watch.watch_time().str() << endl; 00049 sleep(1); 00050 00051 cout << "Watch is running for " << watch.watch_time().str() << endl; 00052 sleep(1); 00053 00054 watch.pause(&time); 00055 cout << "Start pausing at "<< time.str() << endl; 00056 sleep(1); 00057 00058 cout << "Watch is running for " << watch.watch_time().str() << endl; 00059 sleep(1); 00060 00061 cout << "Watch is running for " << watch.watch_time().str() << endl; 00062 sleep(1); 00063 00064 watch.start(&time); 00065 cout << "Resuming at "<< time.str() << endl; 00066 sleep(1); 00067 00068 watch.stop(&time); 00069 cout << "Stopping watch at "<< time.str() << endl; 00070 00071 cout << "Watch is running for " << watch.watch_time().str() << endl; 00072 00073 time = watch.clock_time(); 00074 cout << "Current clock time is " << time.str() << endl; 00075 00076 Clock::finalize(); 00077 00078 return 0; 00079 }