Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
get_time.hGo to the documentation of this file.00001 #ifndef INCLUDED_get_time_h 00002 #define INCLUDED_get_time_h 00003 00004 #ifdef PLATFORM_APERIOS 00005 00006 //!a simple way to get the current time since boot in milliseconds (see TimeET for better accuracy) 00007 unsigned int get_time(); 00008 00009 #else //PLATFORM_LOCAL 00010 00011 //! If we're running locally, these will let users in "project" space control time for simulation 00012 namespace project_get_time { 00013 //! This will default to -1, which signals get_time() to use get_time_callback. Any other value will cause that value to be used instead. 00014 extern unsigned int simulation_time; 00015 //! This by default will return the time in milliseconds since the first call was made. Note this is a function pointer, so you can reassign it to your own implementation! 00016 /*! For instance, the simulator can assign a function which forwards 00017 * the call to SharedGlobals::get_time(), so that all processes get 00018 * consistent time values under control of the simulator */ 00019 extern unsigned int (*get_time_callback)(); 00020 } 00021 00022 //! This will call and return project_get_time::get_time_callback if project_get_time::simulation_time is -1. Otherwise simulation_time is returned. 00023 /*! Default values are set such that the system clock will be used, 00024 * and values will range from 0 (first call) onward. However, by 00025 * reassigning project_get_time::get_time_callback to your own 00026 * function, you can control the flow of time however you wish. */ 00027 inline unsigned int get_time() { 00028 if(project_get_time::simulation_time==-1U) 00029 return (*project_get_time::get_time_callback)(); 00030 else 00031 return project_get_time::simulation_time; 00032 } 00033 00034 #endif 00035 00036 00037 /*! @file 00038 * @brief prototype for get_time(), a simple way to get the current time since boot in milliseconds 00039 * @author ejt (Creator) 00040 * 00041 * $Author: ejt $ 00042 * $Name: tekkotsu-2_4_1 $ 00043 * $Revision: 1.4 $ 00044 * $State: Exp $ 00045 * $Date: 2005/06/14 22:11:46 $ 00046 */ 00047 00048 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4 |