00001 00002 /*************************************************************************** 00003 * clock.cpp - Clock aspect for Fawkes 00004 * 00005 * Created: Tue June 12 22:30:33 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 <aspect/clock.h> 00025 00026 namespace fawkes { 00027 00028 /** @class ClockAspect <aspect/clock.h> 00029 * Thread aspect that allows to obtain the current time from the clock. 00030 * Threads that need to deal with the current time should have this aspect 00031 * and not obtain the time by means of gettimeofday! 00032 * 00033 * @ingroup Aspects 00034 * @author Daniel Beck 00035 */ 00036 00037 00038 /** @var Clock ClockAspect::clock 00039 * By means of this member access to the clock is given. 00040 */ 00041 00042 /** Virtual empty destructor. */ 00043 ClockAspect::~ClockAspect() 00044 { 00045 } 00046 00047 00048 /** Set the clock. 00049 * It is guaranteed that this is called for a clock thread before 00050 * Thread::start() is called (when running regularly inside Fawkes). 00051 * @param clock Clock instance to use. 00052 */ 00053 void 00054 ClockAspect::init_ClockAspect(Clock* clock) 00055 { 00056 this->clock = clock; 00057 } 00058 00059 } // end namespace fawkes