Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-10-16 15:41:50 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-10-16 15:41:50 +0400
commit7b2567924b9b86961cd4c07b76653f49939cab1c (patch)
treeadcf1091db6f3f78c05c6b02c567a9b77fc10092 /source/gameengine/GameLogic
parent063982914038ecd578bab7849a1e94cccbb8d8b9 (diff)
Switch fixed time system. Logic updates should now happen at 30Hz, physics at 60Hz. (By default, use Python to set.) Some actuators still run at framerate (IPO, Action) for nice smooth animation, and an excuse to buy high end hardware.
Keyboard sensors can now hook escape key. Ctrl-Break can be used from within blender if you've forgotten an end game actuator. Fixed a stupid bug preventing some actuators working (like TrackTo).
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.h3
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.cpp17
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.h4
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.cpp5
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.h2
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardManager.h3
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp3
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.cpp20
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h4
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.h22
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.h2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.h2
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.h2
25 files changed, 63 insertions, 62 deletions
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
index 18423c4171f..c4b5b8197a7 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
@@ -52,7 +52,7 @@ SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr)
-void SCA_AlwaysEventManager::NextFrame(double curtime,double deltatime)
+void SCA_AlwaysEventManager::NextFrame()
{
for (vector<class SCA_ISensor*>::const_iterator i= m_sensors.begin();!(i==m_sensors.end());i++)
{
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
index 6ac00515a0e..bffd21da74c 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
+++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
@@ -41,7 +41,7 @@ class SCA_AlwaysEventManager : public SCA_EventManager
class SCA_LogicManager* m_logicmgr;
public:
SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr);
- virtual void NextFrame(double curtime,double deltatime);
+ virtual void NextFrame();
virtual void RegisterSensor(SCA_ISensor* sensor);
diff --git a/source/gameengine/GameLogic/SCA_EventManager.cpp b/source/gameengine/GameLogic/SCA_EventManager.cpp
index 468d9a8c381..cf4af636290 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_EventManager.cpp
@@ -35,6 +35,7 @@
#include <config.h>
#endif
+
SCA_EventManager::SCA_EventManager(EVENT_MANAGER_TYPE mgrtype)
:m_mgrtype(mgrtype)
{
@@ -59,6 +60,15 @@ void SCA_EventManager::RemoveSensor(class SCA_ISensor* sensor)
}
}
+void SCA_EventManager::NextFrame(double curtime, double fixedtime)
+{
+ NextFrame();
+}
+
+void SCA_EventManager::NextFrame()
+{
+ assert(false && "Event managers should override a NextFrame method");
+}
void SCA_EventManager::EndFrame()
{
diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h
index 67908b9d5c7..92bda9df170 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ b/source/gameengine/GameLogic/SCA_EventManager.h
@@ -58,7 +58,8 @@ public:
virtual ~SCA_EventManager();
virtual void RemoveSensor(class SCA_ISensor* sensor);
- virtual void NextFrame(double curtime,double deltatime)=0;
+ virtual void NextFrame(double curtime, double fixedtime);
+ virtual void NextFrame();
virtual void EndFrame();
virtual void RegisterSensor(class SCA_ISensor* sensor)=0;
int GetType();
diff --git a/source/gameengine/GameLogic/SCA_IActuator.cpp b/source/gameengine/GameLogic/SCA_IActuator.cpp
index 31e6d3fdb10..322936c7819 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_IActuator.cpp
@@ -64,11 +64,6 @@ void SCA_IActuator::RemoveAllEvents()
-bool SCA_IActuator::Update(double curtime,double deltatime)
-{
- return true;
-}
-
bool SCA_IActuator::IsNegativeEvent() const
@@ -91,7 +86,19 @@ bool SCA_IActuator::IsNegativeEvent() const
return !bPositiveEvent && bNegativeEvent;
}
+bool SCA_IActuator::Update(double curtime, bool frame)
+{
+ if (frame)
+ return Update();
+
+ return true;
+}
+bool SCA_IActuator::Update()
+{
+ assert(false && "Actuators should override an Update method.");
+ return false;
+}
void SCA_IActuator::ProcessReplica()
{
diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h
index 6b3d1007079..e58ac74dacf 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.h
+++ b/source/gameengine/GameLogic/SCA_IActuator.h
@@ -60,8 +60,8 @@ public:
*/
- virtual bool Update(double curtime,
- double deltatime);
+ virtual bool Update(double curtime, bool frame);
+ virtual bool Update();
/**
* Add an event to an actuator.
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.cpp b/source/gameengine/GameLogic/SCA_IInputDevice.cpp
index d73549b8818..87d161ecabc 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.cpp
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.cpp
@@ -50,7 +50,10 @@ SCA_IInputDevice::~SCA_IInputDevice()
{
}
-
+void SCA_IInputDevice::HookEscape()
+{
+ assert(false && "This device does not support hooking escape.");
+}
void SCA_IInputDevice::ClearStatusTable(int tableid)
{
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index b2ed8686b43..6dee608a568 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -291,6 +291,8 @@ public:
*/
virtual int GetNumJustEvents();
+ virtual void HookEscape();
+
/* Next frame: we calculate the new key states. This goes as follows:
*
* KX_NO_INPUTSTATUS -> KX_NO_INPUTSTATUS
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
index 039f0c14801..cd7e07a7e81 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
@@ -66,7 +66,7 @@ SCA_IInputDevice* SCA_KeyboardManager::GetInputDevice()
-void SCA_KeyboardManager::NextFrame(double curtime,double deltatime)
+void SCA_KeyboardManager::NextFrame()
{
//const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
// cerr << "SCA_KeyboardManager::NextFrame"<< endl;
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h
index fcdb8ed5c4e..562f28417ad 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardManager.h
@@ -56,9 +56,8 @@ public:
virtual ~SCA_KeyboardManager();
bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
-
- virtual void NextFrame(double curtime,double deltatime);
+ virtual void NextFrame();
virtual void RegisterSensor(class SCA_ISensor* sensor);
SCA_IInputDevice* GetInputDevice();
};
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 1eee83ad3d6..fb8c340b09e 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -62,7 +62,8 @@ SCA_KeyboardSensor::SCA_KeyboardSensor(SCA_KeyboardManager* keybdmgr,
m_targetprop(targetProp),
m_toggleprop(toggleProp)
{
-
+ if (hotkey == SCA_IInputDevice::KX_ESCKEY)
+ keybdmgr->GetInputDevice()->HookEscape();
// SetDrawColor(0xff0000ff);
m_val=0;
}
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp
index 62b532ee5a0..0829fb0657b 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.cpp
+++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp
@@ -42,6 +42,7 @@
#include <config.h>
#endif
+
SCA_LogicManager::SCA_LogicManager()
{
}
@@ -175,13 +176,10 @@ void SCA_LogicManager::RegisterToActuator(SCA_IController* controller,SCA_IActua
-void SCA_LogicManager::BeginFrame(double curtime,double deltatime)
+void SCA_LogicManager::BeginFrame(double curtime, double fixedtime)
{
- for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin();
- !(ie==m_eventmanagers.end());ie++)
- {
- (*ie)->NextFrame(curtime,deltatime);
- }
+ for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++)
+ (*ie)->NextFrame(curtime, fixedtime);
// for this frame, look up for activated sensors, and build the collection of triggered controllers
int numsensors = this->m_activatedsensors.size();
@@ -214,11 +212,10 @@ void SCA_LogicManager::BeginFrame(double curtime,double deltatime)
-void SCA_LogicManager::UpdateFrame(double curtime,double deltatime)
+void SCA_LogicManager::UpdateFrame(double curtime, bool frame)
{
vector<SmartActuatorPtr>::iterator ra;
- for (ra = m_removedActuators.begin();
- !(ra == m_removedActuators.end());ra++)
+ for (ra = m_removedActuators.begin(); !(ra == m_removedActuators.end()); ra++)
{
m_activeActuators.erase(*ra);
(*ra)->SetActive(false);
@@ -228,7 +225,7 @@ void SCA_LogicManager::UpdateFrame(double curtime,double deltatime)
for (set<SmartActuatorPtr>::iterator ia = m_activeActuators.begin();!(ia==m_activeActuators.end());ia++)
{
//SCA_IActuator* actua = *ia;
- if (!(*ia)->Update(curtime,deltatime))
+ if (!(*ia)->Update(curtime, frame))
{
//*ia = m_activeactuators.back();
m_removedActuators.push_back(*ia);
@@ -238,8 +235,7 @@ void SCA_LogicManager::UpdateFrame(double curtime,double deltatime)
}
}
- for ( ra = m_removedActuators.begin();
- !(ra == m_removedActuators.end());ra++)
+ for ( ra = m_removedActuators.begin(); !(ra == m_removedActuators.end()); ra++)
{
m_activeActuators.erase(*ra);
(*ra)->SetActive(false);
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 4447104a0a2..7af1190f03b 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -123,8 +123,8 @@ public:
void RegisterToActuator(SCA_IController* controller,
class SCA_IActuator* actuator);
- void BeginFrame(double curtime,double deltatime);
- void UpdateFrame(double curtime,double deltatime);
+ void BeginFrame(double curtime, double fixedtime);
+ void UpdateFrame(double curtime, bool frame);
void EndFrame();
void AddActivatedSensor(SCA_ISensor* sensor);
void AddActiveActuator(SCA_IActuator* sensor,class CValue* event);
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp
index 96abe2c9135..e4d54c94395 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp
@@ -74,7 +74,7 @@ SCA_IInputDevice* SCA_MouseManager::GetInputDevice()
-void SCA_MouseManager::NextFrame(double curtime,double deltatime)
+void SCA_MouseManager::NextFrame()
{
if (m_mousedevice)
{
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h
index 4c8fe102bfe..e98405b1b7d 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.h
+++ b/source/gameengine/GameLogic/SCA_MouseManager.h
@@ -64,7 +64,7 @@ public:
* mouse related evenst. Can also flag mouse movement.
*/
bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
- virtual void NextFrame(double curtime,double deltatime);
+ virtual void NextFrame();
virtual void RegisterSensor(class SCA_ISensor* sensor);
SCA_IInputDevice* GetInputDevice();
};
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
index c416d8e1dd5..a39e59fe451 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
@@ -58,7 +58,7 @@ SCA_PropertyActuator::~SCA_PropertyActuator()
{
}
-bool SCA_PropertyActuator::Update(double curtime,double deltatime)
+bool SCA_PropertyActuator::Update()
{
bool result = false;
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h
index 2fdf1a62559..cdcda7a84e0 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.h
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.h
@@ -62,41 +62,23 @@ public:
SCA_PropertyActuator(
-
SCA_IObject* gameobj,
-
CValue* sourceObj,
-
const STR_String& propname,
-
const STR_String& expr,
-
int acttype,
-
PyTypeObject* T=&Type
-
);
~SCA_PropertyActuator();
-
CValue*
-
GetReplica(
-
);
-
- bool
-
- Update(
-
- double curtime,
-
- double deltatime
-
- );
+ virtual bool
+ Update();
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp b/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
index 4b81b0e4124..4ac3d162229 100644
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
@@ -59,7 +59,7 @@ void SCA_PropertyEventManager::RegisterSensor(SCA_ISensor* sensor)
-void SCA_PropertyEventManager::NextFrame(double curtime,double deltatime)
+void SCA_PropertyEventManager::NextFrame()
{
// check for changed properties
for (vector<SCA_ISensor*>::const_iterator it = m_sensors.begin();!(it==m_sensors.end());it++)
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
index dccaa6b52fe..664beb68695 100644
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h
+++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
@@ -45,7 +45,7 @@ class SCA_PropertyEventManager : public SCA_EventManager
public:
SCA_PropertyEventManager(class SCA_LogicManager* logicmgr);
virtual ~SCA_PropertyEventManager();
- virtual void NextFrame(double curtime,double deltatime);
+ virtual void NextFrame();
virtual void RegisterSensor(SCA_ISensor* sensor);
//SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
};
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index b4a28291e66..da6fe06a708 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -86,7 +86,7 @@ CValue* SCA_RandomActuator::GetReplica()
-bool SCA_RandomActuator::Update(double curtime,double deltatime)
+bool SCA_RandomActuator::Update()
{
bool result = false;
bool bNegativeEvent = IsNegativeEvent();
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h
index 1048790c9b6..4be7f2dbe9e 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.h
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.h
@@ -91,7 +91,7 @@ class SCA_RandomActuator : public SCA_IActuator
const STR_String &propName,
PyTypeObject* T=&Type);
virtual ~SCA_RandomActuator();
- virtual bool Update(double curtime,double deltatime);
+ virtual bool Update();
virtual CValue* GetReplica();
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
index 17cfa351994..6bf10a83f55 100644
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
@@ -51,7 +51,7 @@ SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr)
}
-void SCA_RandomEventManager::NextFrame(double curtime,double deltatime)
+void SCA_RandomEventManager::NextFrame()
{
for (vector<class SCA_ISensor*>::const_iterator i= m_sensors.begin();!(i==m_sensors.end());i++)
{
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.h b/source/gameengine/GameLogic/SCA_RandomEventManager.h
index f0832044042..17b2894434d 100644
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.h
+++ b/source/gameengine/GameLogic/SCA_RandomEventManager.h
@@ -47,7 +47,7 @@ class SCA_RandomEventManager : public SCA_EventManager
public:
SCA_RandomEventManager(class SCA_LogicManager* logicmgr);
- virtual void NextFrame(double curtime,double deltatime);
+ virtual void NextFrame();
virtual void RegisterSensor(SCA_ISensor* sensor);
};
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
index 05d1bebf18a..d97727d2a33 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
@@ -70,9 +70,9 @@ void SCA_TimeEventManager::RegisterSensor(SCA_ISensor* sensor)
-void SCA_TimeEventManager::NextFrame(double curtime,double deltatime)
+void SCA_TimeEventManager::NextFrame(double curtime, double fixedtime)
{
- if (m_timevalues.size() > 0)
+ if (m_timevalues.size() > 0 && fixedtime > 0.0)
{
CFloatValue* floatval = new CFloatValue(curtime);
@@ -80,7 +80,7 @@ void SCA_TimeEventManager::NextFrame(double curtime,double deltatime)
for (vector<CValue*>::iterator it = m_timevalues.begin();
!(it == m_timevalues.end()); it++)
{
- float newtime = (*it)->GetNumber() + deltatime;
+ float newtime = (*it)->GetNumber() + fixedtime;
floatval->SetFloat(newtime);
(*it)->SetValue(floatval);
}
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h
index fb2f1cee970..388d9ce53bd 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.h
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.h
@@ -46,7 +46,7 @@ public:
SCA_TimeEventManager(class SCA_LogicManager* logicmgr);
virtual ~SCA_TimeEventManager();
- virtual void NextFrame(double curtime,double deltatime);
+ virtual void NextFrame(double curtime, double fixedtime);
virtual void RegisterSensor(class SCA_ISensor* sensor);
void AddTimeProperty(CValue* timeval);
void RemoveTimeProperty(CValue* timeval);