From 4007d3e96724295de3a67a03aca50cfea6a3829a Mon Sep 17 00:00:00 2001
From: Francois Bleibel <fbleibel@gmail.com>
Date: Wed, 30 Jun 2010 15:55:22 +0900
Subject: [PATCH] Added 3 tools. Some minor corrections (such as correctly
 exporting classes in plugins)

---
 include/CMakeLists.txt                        |   8 +-
 include/sot-core/constraint.h                 |   2 +-
 include/sot-core/contiifstream.h              |   2 +-
 include/sot-core/feature-1d.h                 |   2 +-
 include/sot-core/feature-generic.h            |   2 +-
 include/sot-core/feature-joint-limits.h       |   2 +-
 include/sot-core/feature-line-distance.h      |   2 +-
 include/sot-core/feature-point6d-relative.h   |   2 +-
 include/sot-core/feature-point6d.h            |   2 +-
 include/sot-core/feature-task.h               |   2 +-
 include/sot-core/feature-vector3.h            |   2 +-
 include/sot-core/feature-visual-point.h       |   2 +-
 include/sot-core/gain-adaptive.h              |   2 +-
 include/sot-core/gain-hyperbolic.h            |   2 +-
 include/sot-core/import-default-paths.h       |   8 +
 include/sot-core/memory-task-sot.h            |   2 +-
 include/sot-core/op-point-modifier.h          |   2 +-
 include/sot-core/periodic-call.h              |  94 +++++++
 include/sot-core/reader.h                     |   2 +-
 include/sot-core/rotation-simple.h            |   2 +-
 .../solver-hierarchical-inequalities.h        |   2 +-
 include/sot-core/sot-h.h                      |   2 +-
 include/sot-core/sot-qr.h                     |   2 +-
 include/sot-core/sot.h                        |   2 +-
 include/sot-core/task-conti.h                 |   2 +-
 include/sot-core/task-pd.h                    |   2 +-
 include/sot-core/task-unilateral.h            |   2 +-
 include/sot-core/task.h                       |   2 +-
 include/sot-core/time-stamp.h                 | 117 +++++++++
 include/sot-core/timer.h                      | 198 ++++++++++++++
 include/sot-core/utils-windows.h              |   4 +-
 include/sot-core/weighted-sot.h               |   2 +-
 src/CMakeLists.txt                            |   5 +
 src/tools/periodic-call.cpp                   | 243 ++++++++++++++++++
 src/tools/time-stamp.cpp                      | 142 ++++++++++
 src/tools/timer.cpp                           | 103 ++++++++
 src/tools/utils-windows.cpp                   |  46 ++++
 37 files changed, 991 insertions(+), 29 deletions(-)
 create mode 100644 include/sot-core/import-default-paths.h
 create mode 100644 include/sot-core/periodic-call.h
 create mode 100644 include/sot-core/time-stamp.h
 create mode 100644 include/sot-core/timer.h
 create mode 100644 src/tools/periodic-call.cpp
 create mode 100644 src/tools/time-stamp.cpp
 create mode 100644 src/tools/timer.cpp
 create mode 100644 src/tools/utils-windows.cpp

diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index b2e48559..66ca7fac 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -88,8 +88,14 @@ rotation-simple.h
 weighted-sot.h
 solver-hierarchical-inequalities.h
 
-#reader
+#traces
 reader.h
+
+#tools
+periodic-call.h
+utils-windows.h
+time-stamp.h
+timer.h
 )
 
 # Recreate correct path for the headers
diff --git a/include/sot-core/constraint.h b/include/sot-core/constraint.h
index 8fd216d4..ffb1c94f 100644
--- a/include/sot-core/constraint.h
+++ b/include/sot-core/constraint.h
@@ -46,7 +46,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (Constraint_EXPORTS)
+#  if defined (constraint_EXPORTS)
 #    define SOTCONSTRAINT_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTCONSTRAINT_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/contiifstream.h b/include/sot-core/contiifstream.h
index 87246de5..67e57814 100644
--- a/include/sot-core/contiifstream.h
+++ b/include/sot-core/contiifstream.h
@@ -44,7 +44,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (Contiifstream_EXPORTS)
+#  if defined (contiifstream_EXPORTS)
 #    define SOTCONTIIFSTREAM_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTCONTIIFSTREAM_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-1d.h b/include/sot-core/feature-1d.h
index 1d8e54b4..182af621 100644
--- a/include/sot-core/feature-1d.h
+++ b/include/sot-core/feature-1d.h
@@ -34,7 +34,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeature1D_EXPORTS)
+#  if defined (feature_1d_EXPORTS)
 #    define SOTFEATURE1D_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATURE1D_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-generic.h b/include/sot-core/feature-generic.h
index dde64b54..5753917f 100644
--- a/include/sot-core/feature-generic.h
+++ b/include/sot-core/feature-generic.h
@@ -34,7 +34,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeatureGeneric_EXPORTS)
+#  if defined (feature_generic_EXPORTS)
 #    define SOTFEATUREGENERIC_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATUREGENERIC_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-joint-limits.h b/include/sot-core/feature-joint-limits.h
index d9f589c3..1424560f 100644
--- a/include/sot-core/feature-joint-limits.h
+++ b/include/sot-core/feature-joint-limits.h
@@ -34,7 +34,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeatureJointLimits_EXPORTS)
+#  if defined (feature_joint_limits_EXPORTS)
 #    define SOTFEATUREJOINTLIMITS_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATUREJOINTLIMITS_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-line-distance.h b/include/sot-core/feature-line-distance.h
index 9dee937e..2b324c13 100644
--- a/include/sot-core/feature-line-distance.h
+++ b/include/sot-core/feature-line-distance.h
@@ -35,7 +35,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotFeatureLineDistance_EXPORTS)
+#  if defined (feature_line_distance_EXPORTS)
 #    define SOTFEATURELINEDISTANCE_EXPORT __declspec(dllexport)
 #  else
 #    define SOTFEATURELINEDISTANCE_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-point6d-relative.h b/include/sot-core/feature-point6d-relative.h
index 21d277d7..faa5fba8 100644
--- a/include/sot-core/feature-point6d-relative.h
+++ b/include/sot-core/feature-point6d-relative.h
@@ -36,7 +36,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeaturePoint6dRelative_EXPORTS)
+#  if defined (feature_point_6d_relative_EXPORTS)
 #    define SOTFEATUREPOINT6DRELATIVE_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATUREPOINT6DRELATIVE_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-point6d.h b/include/sot-core/feature-point6d.h
index 4c4f46a6..97cfd6fa 100644
--- a/include/sot-core/feature-point6d.h
+++ b/include/sot-core/feature-point6d.h
@@ -35,7 +35,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeaturePoint6d_EXPORTS)
+#  if defined (feature_point_6d_EXPORTS)
 #    define SOTFEATUREPOINT6D_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATUREPOINT6D_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-task.h b/include/sot-core/feature-task.h
index f567ccd7..132a17cf 100644
--- a/include/sot-core/feature-task.h
+++ b/include/sot-core/feature-task.h
@@ -35,7 +35,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeatureTask_EXPORTS)
+#  if defined (feature_task_EXPORTS)
 #    define SOTFEATURETASK_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATURETASK_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-vector3.h b/include/sot-core/feature-vector3.h
index 87711b25..b72930fe 100644
--- a/include/sot-core/feature-vector3.h
+++ b/include/sot-core/feature-vector3.h
@@ -35,7 +35,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotFeatureVector3_EXPORTS)
+#  if defined (feature_vector3_EXPORTS)
 #    define SOTFEATUREVECTOR3_EXPORT __declspec(dllexport)
 #  else
 #    define SOTFEATUREVECTOR3_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/feature-visual-point.h b/include/sot-core/feature-visual-point.h
index 5ebf6d98..52c8b8c5 100644
--- a/include/sot-core/feature-visual-point.h
+++ b/include/sot-core/feature-visual-point.h
@@ -34,7 +34,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotFeatureVisualPoint_EXPORTS)
+#  if defined (feature_visual_point_EXPORTS)
 #    define SOTFEATUREVISUALPOINT_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTFEATUREVISUALPOINT_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/gain-adaptive.h b/include/sot-core/gain-adaptive.h
index 50e27df5..31892939 100644
--- a/include/sot-core/gain-adaptive.h
+++ b/include/sot-core/gain-adaptive.h
@@ -39,7 +39,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotGainAdaptive_EXPORTS)
+#  if defined (gain_adaptive_EXPORTS)
 #    define SOTGAINADAPTATIVE_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTGAINADAPTATIVE_EXPORT  __declspec(dllimport)
diff --git a/include/sot-core/gain-hyperbolic.h b/include/sot-core/gain-hyperbolic.h
index 80d7bb2a..43311796 100644
--- a/include/sot-core/gain-hyperbolic.h
+++ b/include/sot-core/gain-hyperbolic.h
@@ -40,7 +40,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotGainHyperbolic_EXPORTS)
+#  if defined (gain_hyperbolic_EXPORTS)
 #    define SOTGAINHYPERBOLIC_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTGAINHYPERBOLIC_EXPORT  __declspec(dllimport)
diff --git a/include/sot-core/import-default-paths.h b/include/sot-core/import-default-paths.h
new file mode 100644
index 00000000..d0495ae6
--- /dev/null
+++ b/include/sot-core/import-default-paths.h
@@ -0,0 +1,8 @@
+// -*- c++ -*-
+#ifndef SOT_FACTORY_COMMAND_IMPORT_DEFAULT_PATHS_H
+# define SOT_FACTORY_COMMAND_IMPORT_DEFAULT_PATHS_H
+
+/// Default script path as known by CMake at configure time.
+# define SOT_IMPORT_DEFAULT_PATHS "/home/blue/sot-lib/script"
+
+#endif //! SOT_FACTORY_COMMAND_IMPORT_DEFAULT_PATHS_H
diff --git a/include/sot-core/memory-task-sot.h b/include/sot-core/memory-task-sot.h
index b46cece8..6a494ee1 100644
--- a/include/sot-core/memory-task-sot.h
+++ b/include/sot-core/memory-task-sot.h
@@ -30,7 +30,7 @@
 
 #ifndef SOTSOT_CORE_EXPORT
 # if defined (WIN32) 
-#  if defined (sotSOT_CORE_EXPORTS) 
+#  if defined (sot_core_EXPORTS)
 #    define SOTSOT_CORE_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTSOT_CORE_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/op-point-modifier.h b/include/sot-core/op-point-modifier.h
index 38a07b10..797ada48 100644
--- a/include/sot-core/op-point-modifier.h
+++ b/include/sot-core/op-point-modifier.h
@@ -34,7 +34,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (OpPointModifier_EXPORTS)
+#  if defined (op_point_modifier_EXPORTS)
 #    define SOTOPPOINTMODIFIER_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTOPPOINTMODIFIER_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/periodic-call.h b/include/sot-core/periodic-call.h
new file mode 100644
index 00000000..5c459ade
--- /dev/null
+++ b/include/sot-core/periodic-call.h
@@ -0,0 +1,94 @@
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * Copyright Projet JRL-Japan, 2007
+ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ * File:      PeriodicCall.h
+ * Project:   SOT
+ * Author:    Nicolas Mansard
+ *
+ * Version control
+ * ===============
+ *
+ *  $Id$
+ *
+ * Description
+ * ============
+ *
+ *
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+
+#ifndef __SOT_PERIODICCALL_HH__
+#define __SOT_PERIODICCALL_HH__
+
+/* --------------------------------------------------------------------- */
+/* --- INCLUDE --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+
+/* SOT */
+#include <dynamic-graph/signal-base.h>
+#include <sot-core/sot-core-api.h>
+/* STD */
+#include <list>
+#include <map>
+#include <string>
+
+/* --------------------------------------------------------------------- */
+/* --- CLASS ----------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+namespace sot {
+
+/*!
+  \class PeriodicCall
+*/
+class SOT_CORE_EXPORT PeriodicCall
+{
+ protected:
+  typedef std::map< std::string,dynamicgraph::SignalBase<int>* > SignalMapType;
+  SignalMapType signalMap;
+  
+  typedef std::list< std::string > CmdListType;
+  CmdListType cmdList;
+
+  int innerTime;
+
+  /* --- FUNCTIONS ------------------------------------------------------------ */
+ public:
+  PeriodicCall( void );
+  virtual ~PeriodicCall( void ) {}
+
+  void addSignal( const std::string &name, dynamicgraph::SignalBase<int>& sig );
+  void addSignal( std::istringstream& args );
+  void rmSignal( const std::string &name );
+  void rmSignal( std::istringstream& args );
+
+  void addCmd( std::istringstream& args );
+  void rmCmd( std::istringstream& args );
+
+  void runSignals( const int& t );
+  void runCmds( void );
+  void run( const int& t );
+  
+  void clear( void ) { signalMap.clear(); cmdList.clear(); }
+
+  void display( std::ostream& os ) const;
+  bool commandLine( const std::string& cmdLine,
+		    std::istringstream& cmdArgs,
+		    std::ostream& os );
+};
+
+
+
+} // namespace sot
+
+
+
+#endif // #ifndef __SOT_PERIODICCALL_HH__
+
+/*
+ * Local variables:
+ * c-basic-offset: 2
+ * End:
+ */
diff --git a/include/sot-core/reader.h b/include/sot-core/reader.h
index fdf0db93..03260163 100644
--- a/include/sot-core/reader.h
+++ b/include/sot-core/reader.h
@@ -50,7 +50,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32) 
-#  if defined (sotReader_EXPORTS)
+#  if defined (reader_EXPORTS)
 #    define SOTREADER_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTREADER_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/rotation-simple.h b/include/sot-core/rotation-simple.h
index 92aa754d..023e717c 100644
--- a/include/sot-core/rotation-simple.h
+++ b/include/sot-core/rotation-simple.h
@@ -18,7 +18,7 @@
 
 #ifndef SOTSOTH_EXPORT 
 #  if defined (WIN32)
-#    if defined (sotSOTH_EXPORTS)
+#    if defined (sot_h_EXPORTS)
 #      define SOTSOTH_EXPORT __declspec(dllexport)
 #    else
 #      define SOTSOTH_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/solver-hierarchical-inequalities.h b/include/sot-core/solver-hierarchical-inequalities.h
index 3417c66e..b141a88c 100644
--- a/include/sot-core/solver-hierarchical-inequalities.h
+++ b/include/sot-core/solver-hierarchical-inequalities.h
@@ -39,7 +39,7 @@
 
 #ifndef SOTSOTH_EXPORT 
 #  if defined (WIN32)
-#    if defined (sotSOTH_EXPORTS)
+#    if defined (sot_h_EXPORTS)
 #      define SOTSOTH_EXPORT __declspec(dllexport)
 #    else
 #      define SOTSOTH_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/sot-h.h b/include/sot-core/sot-h.h
index 69e36fcd..fc3957d5 100644
--- a/include/sot-core/sot-h.h
+++ b/include/sot-core/sot-h.h
@@ -36,7 +36,7 @@
 
 #ifndef SOTSOTH_EXPORT 
 # if defined (WIN32)
-#  if defined (sotSOTH_EXPORTS)
+#  if defined (sot_h_EXPORTS)
 #    define SOTSOTH_EXPORT __declspec(dllexport)
 #  else
 #    define SOTSOTH_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/sot-qr.h b/include/sot-core/sot-qr.h
index 7cdba61c..52d025ac 100644
--- a/include/sot-core/sot-qr.h
+++ b/include/sot-core/sot-qr.h
@@ -44,7 +44,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotSOTQr_EXPORTS)
+#  if defined (sot_qr_EXPORTS)
 #    define SOTSOTQR_EXPORT __declspec(dllexport)
 #  else
 #    define SOTSOTQR_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/sot.h b/include/sot-core/sot.h
index 5abee9f2..f78c23c3 100644
--- a/include/sot-core/sot.h
+++ b/include/sot-core/sot.h
@@ -45,7 +45,7 @@ namespace ml = maal::boost;
 
 #ifndef SOTSOT_CORE_EXPORT
 # if defined (WIN32) 
-#  if defined (sotSOT_CORE_EXPORTS) 
+#  if defined (sot_EXPORTS)
 #    define SOTSOT_CORE_EXPORT __declspec(dllexport)
 #  else  
 #    define SOTSOT_CORE_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/task-conti.h b/include/sot-core/task-conti.h
index b3e351bb..4c651df5 100644
--- a/include/sot-core/task-conti.h
+++ b/include/sot-core/task-conti.h
@@ -45,7 +45,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotTaskConti_EXPORTS)
+#  if defined (task_conti_EXPORTS)
 #    define SOTTASKCONTI_EXPORT __declspec(dllexport)
 #  else
 #    define SOTTASKCONTI_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/task-pd.h b/include/sot-core/task-pd.h
index 0eb2301d..271703da 100644
--- a/include/sot-core/task-pd.h
+++ b/include/sot-core/task-pd.h
@@ -35,7 +35,7 @@
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotTaskPD_EXPORTS)
+#  if defined (task_pd_EXPORTS)
 #    define SOTTASKPD_EXPORT __declspec(dllexport)
 #  else
 #    define SOTTASKPD_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/task-unilateral.h b/include/sot-core/task-unilateral.h
index 0d09ae82..df5696cd 100644
--- a/include/sot-core/task-unilateral.h
+++ b/include/sot-core/task-unilateral.h
@@ -47,7 +47,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotTaskUnilateral_EXPORTS)
+#  if defined (task_unilateral_EXPORTS)
 #    define SOTTASKUNILATERAL_EXPORT __declspec(dllexport)
 #  else
 #    define SOTTASKUNILATERAL_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/task.h b/include/sot-core/task.h
index 72f123f8..c348dc3b 100644
--- a/include/sot-core/task.h
+++ b/include/sot-core/task.h
@@ -47,7 +47,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotTask_EXPORTS)
+#  if defined task_EXPORTS)
 #    define SOTTASK_EXPORT __declspec(dllexport)
 #  else
 #    define SOTTASK_EXPORT __declspec(dllimport)
diff --git a/include/sot-core/time-stamp.h b/include/sot-core/time-stamp.h
new file mode 100644
index 00000000..d9e34931
--- /dev/null
+++ b/include/sot-core/time-stamp.h
@@ -0,0 +1,117 @@
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * Copyright Projet JRL-Japan, 2007
+ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ * File:      TimeStamp.h
+ * Project:   SOT
+ * Author:    Paul Evrard
+ *
+ * Version control
+ * ===============
+ *
+ *  $Id$
+ *
+ * Description
+ * ============
+ *
+ *
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+
+
+#ifndef __SOT_TIME_STAMP__HH
+#define __SOT_TIME_STAMP__HH
+
+/* --------------------------------------------------------------------- */
+/* --- INCLUDE --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+
+/* Matrix */
+#include <MatrixAbstractLayer/boost.h>
+namespace ml = maal::boost;
+
+/* Classes standards. */
+#ifndef WIN32
+#include <sys/time.h>
+#else /*WIN32*/
+#include <Winsock2.h>
+#include <sot/utils-windows.h>
+#endif /*WIN32*/
+
+/* SOT */
+#include <dynamic-graph/entity.h>
+#include <dynamic-graph/all-signals.h>
+#include <sot-core/debug.h>
+
+/* --------------------------------------------------------------------- */
+/* --- API ------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+#if defined (WIN32) 
+#  if defined (TimeStamp_EXPORTS)
+#    define TimeStamp_EXPORT __declspec(dllexport)
+#  else  
+#    define TimeStamp_EXPORT __declspec(dllimport)
+#  endif 
+#else
+#  define TimeStamp_EXPORT
+#endif
+
+/* --------------------------------------------------------------------- */
+/* --- CLASS ----------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+namespace sot {
+namespace dg = dynamicgraph;
+
+class TimeStamp_EXPORT TimeStamp
+:public dg::Entity
+{
+ public:
+  static const std::string CLASS_NAME;
+  virtual const std::string& getClassName( void ) const { return CLASS_NAME; }
+
+ protected:
+
+  struct timeval val;
+  unsigned int offsetValue;
+  bool offsetSet;
+ 
+ public:
+  
+  /* --- CONSTRUCTION --- */
+  TimeStamp( const std::string& name );
+
+ public: /* --- DISPLAY --- */
+  virtual void display( std::ostream& os ) const;
+
+ public: /* --- SIGNALS --- */
+
+  /* These signals can be called several time per period, given 
+   * each time a different results. Useful for chronos. */
+  dg::Signal<ml::Vector,int> timeSOUT;
+  dg::Signal<double,int> timeDoubleSOUT;
+
+  /* These signals can be called several time per period, but give
+   * always the same results different results. Useful for synchro. */
+  dg::SignalTimeDependent<ml::Vector,int> timeOnceSOUT;
+  dg::SignalTimeDependent<double,int> timeOnceDoubleSOUT;
+
+
+ protected: /* --- SIGNAL FUNCTIONS --- */
+  ml::Vector& getTimeStamp( ml::Vector& res,const int& time );
+  double& getTimeStampDouble( const ml::Vector& vect,double& res );
+    
+ public: /* --- COMMANDS --- */
+  virtual void commandLine( const std::string& cmdLine,
+			    std::istringstream& cmdArgs,
+			    std::ostream& os );
+    
+};
+
+
+} // namespace sot
+
+
+#endif /* #ifndef __SOT_SOT_HH */
diff --git a/include/sot-core/timer.h b/include/sot-core/timer.h
new file mode 100644
index 00000000..bb79fc9e
--- /dev/null
+++ b/include/sot-core/timer.h
@@ -0,0 +1,198 @@
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * Copyright Projet JRL-Japan, 2007
+ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ * File:      Timer.h
+ * Project:   SOT
+ * Author:    Nicolas Mansard
+ *
+ * Version control
+ * ===============
+ *
+ *  $Id$
+ *
+ * Description
+ * ============
+ *
+ *
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+
+
+#ifndef __SOT_TIMER_HH
+#define __SOT_TIMER_HH
+
+/* --------------------------------------------------------------------- */
+/* --- INCLUDE --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+/* Classes standards. */
+#include <list>                    /* Classe std::list   */
+#ifndef WIN32
+#include <sys/time.h>
+#else  /*WIN32*/
+// When including Winsock2.h, the MAL must be included first
+#include <MatrixAbstractLayer/boost.h>
+#include <sot-core/utils-windows.h>
+#include <Winsock2.h>
+#endif /*WIN32*/
+
+/* SOT */
+#include <dynamic-graph/entity.h>
+#include <dynamic-graph/all-signals.h>
+#include <sot-core/debug.h>
+#include <dynamic-graph/interpreter.h>
+
+/* --------------------------------------------------------------------- */
+/* --- API ------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+#if defined (WIN32) 
+#  if defined (timer_EXPORTS)
+#    define Timer_EXPORT __declspec(dllexport)
+#  else  
+#    define Timer_EXPORT __declspec(dllimport)
+#  endif 
+#else
+#  define Timer_EXPORT
+#endif
+
+/* --------------------------------------------------------------------- */
+/* --- CLASS ----------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+namespace dg = dynamicgraph;
+
+template< class T >
+class Timer_EXPORT Timer
+:public dg::Entity
+{
+ public:
+  static const std::string CLASS_NAME;
+  virtual const std::string& getClassName( void ) const { return CLASS_NAME; }
+
+ protected:
+  
+  struct timeval t0,t1;
+  double dt;
+
+ public:
+  
+  /* --- CONSTRUCTION --- */
+  Timer( const std::string& name );
+
+ public: /* --- DISPLAY --- */
+  virtual void display( std::ostream& os ) const;
+  Timer_EXPORT friend std::ostream& operator<< ( std::ostream& os,const Timer<T>& timer )
+    { timer.display(os); return os; }
+
+ public: /* --- SIGNALS --- */
+
+  dg::SignalPtr<T,int> sigSIN;
+  dg::SignalTimeDependent<T,int> sigSOUT;
+  dg::Signal<double,int> timerSOUT;
+
+
+ protected: /* --- SIGNAL FUNCTIONS --- */
+  void plug( dg::Signal<T,int> &sig )
+    {
+      sigSIN = &sig; dt=0.;
+    }
+
+  T& compute( T& t,const int& time )
+    {
+      sotDEBUGIN(15);
+      gettimeofday(&t0,NULL);
+      sotDEBUG(15) << "t0: "<< t0.tv_sec << " - " << t0.tv_usec << std::endl;
+      
+      t = sigSIN( time );
+
+      gettimeofday(&t1,NULL);
+      dt = ( (t1.tv_sec-t0.tv_sec) * 1000. 
+	     + (t1.tv_usec-t0.tv_usec+0.) / 1000. );
+      sotDEBUG(15) << "t1: "<< t1.tv_sec << " - " << t1.tv_usec << std::endl;
+
+      timerSOUT = dt;
+
+      sotDEBUGOUT(15);
+      return t;
+    }
+
+  double& getDt( double& res,const int& time )
+    { 
+      res=dt; 
+      return res;
+    }
+
+
+ public: /* --- COMMANDS --- */
+  virtual void commandLine( const std::string& cmdLine,std::istringstream& cmdArgs,
+			    std::ostream& os );
+
+
+};
+
+void cmdChrono( const std::string& cmd,
+		std::istringstream& args,
+		std::ostream& os );
+
+
+
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+
+/* --- CONSTRUCTION ---------------------------------------------------- */
+template< class T >
+Timer<T>::
+Timer( const std::string& name )
+  :Entity(name)
+   ,t0(),t1()
+   ,dt(0.)
+   ,sigSIN( NULL,"Timer("+name+")::output(T)::in" )
+   ,sigSOUT(  boost::bind(&Timer::compute,this,_1,_2),
+	      sigSIN,
+	      "Timer("+name+")::output(T)::out" )
+   ,timerSOUT( "Timer("+name+")::output(double)::timer" )
+{
+  sotDEBUGIN(15);
+  timerSOUT.setFunction(  boost::bind(&Timer::getDt,this,_1,_2) );
+	      
+  signalRegistration( sigSIN<<sigSOUT<<timerSOUT );
+  sotDEBUGOUT(15);
+}
+
+/* --- DISPLAY --------------------------------------------------------- */
+template< class T >
+void Timer<T>::
+display( std::ostream& os ) const
+{
+  os << "Timer <"<< sigSIN << "> : " << dt << "ms." << std::endl;
+}
+/* --- COMMAND --------------------------------------------------------- */
+template< class T >
+void Timer<T>::
+commandLine( const std::string& cmdLine,std::istringstream& cmdArgs,
+	     std::ostream& os )
+{
+  sotDEBUGIN(15);
+
+  if( cmdLine == "help") 
+    {
+      os << "Timer: "<<std::endl;
+      Entity::commandLine( cmdLine,cmdArgs,os );
+    }
+  else
+    Entity::commandLine( cmdLine,cmdArgs,os );
+  
+  
+  sotDEBUGOUT(15);
+}
+
+
+
+#endif /* #ifndef __SOT_SOT_HH */
+
+
+
+
diff --git a/include/sot-core/utils-windows.h b/include/sot-core/utils-windows.h
index 7a70dbaf..8f55e8ce 100644
--- a/include/sot-core/utils-windows.h
+++ b/include/sot-core/utils-windows.h
@@ -14,13 +14,13 @@
 
 #include < time.h >
 
-struct SOT_EXPORT timezone
+struct SOT_CORE_EXPORT timezone
 {
   int  tz_minuteswest; /* minutes W of Greenwich */
   int  tz_dsttime;     /* type of dst correction */
 };
 
-int SOT_EXPORT gettimeofday(struct timeval *tv, struct timezone *tz);
+int SOT_CORE_EXPORT gettimeofday(struct timeval *tv, struct timezone *tz);
 
 #endif /*WIN32*/
 
diff --git a/include/sot-core/weighted-sot.h b/include/sot-core/weighted-sot.h
index 016f3222..e1a298be 100644
--- a/include/sot-core/weighted-sot.h
+++ b/include/sot-core/weighted-sot.h
@@ -41,7 +41,7 @@ namespace ml = maal::boost;
 /* --------------------------------------------------------------------- */
 
 #if defined (WIN32)
-#  if defined (sotWeightedSOT_CORE_EXPORTS)
+#  if defined (weighted_sot_EXPORTS)
 #    define SOTWEIGHTEDSOT_CORE_EXPORT __declspec(dllexport)
 #  else
 #    define SOTWEIGHTEDSOT_CORE_EXPORT __declspec(dllimport)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index af8fc920..3f511784 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -82,6 +82,11 @@ SET(plugins
 	feature/feature-line-distance
 	
 	traces/reader
+	
+	tools/utils-windows
+	tools/periodic-call
+	tools/time-stamp
+	tools//timer
 )
 
 #Build sot-core
diff --git a/src/tools/periodic-call.cpp b/src/tools/periodic-call.cpp
new file mode 100644
index 00000000..dc180f17
--- /dev/null
+++ b/src/tools/periodic-call.cpp
@@ -0,0 +1,243 @@
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * Copyright Projet JRL-Japan, 2007
+ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ * File:      PeriodicCall.cpp
+ * Project:   SOT
+ * Author:    Nicolas Mansard
+ *
+ * Version control
+ * ===============
+ *
+ *  $Id$
+ *
+ * Description
+ * ============
+ *
+ *
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+
+/* --------------------------------------------------------------------- */
+/* --- INCLUDE --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+/* --- SOT --- */
+#include <sot-core/periodic-call.h>
+#include <dynamic-graph/pool.h>
+#include <dynamic-graph/interpreter.h>
+#include <sot-core/debug.h>
+
+using namespace std;
+using namespace dynamicgraph;
+using namespace sot;
+
+/* --------------------------------------------------------------------- */
+/* --- CLASS ----------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+
+
+PeriodicCall::
+PeriodicCall( void )
+  : signalMap()
+    ,cmdList()
+    ,innerTime( 0 )
+{
+
+}
+
+
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+void PeriodicCall::
+addSignal( const std::string &name, SignalBase<int>& sig )
+{
+  signalMap[ name ] = &sig;
+  return ;
+}
+
+void PeriodicCall::
+addSignal( istringstream& args )
+{
+  string signalName; args >> signalName;
+  istringstream sigISS( signalName );
+  SignalBase<int>& signal = g_pool .getSignal( sigISS );
+  addSignal( signalName,signal );
+  return ;
+}
+
+void PeriodicCall::
+rmSignal( const std::string &name )
+{
+  signalMap.erase( name );
+  return ;
+}
+
+void PeriodicCall::
+rmSignal(  istringstream& args )
+{
+  string signalName; args >> signalName;
+  rmSignal( signalName );
+  return ;
+}
+
+
+
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+void PeriodicCall::
+addCmd( istringstream& args )
+{
+  stringbuf* pbuf=args.rdbuf();
+  const unsigned int size = pbuf->in_avail();
+  char *buffer = new char[ size+1 ];
+  pbuf->sgetn( buffer,size );
+
+  buffer[size]='\0';
+  cmdList.push_back( buffer );
+  
+  delete buffer;
+  return ;
+}
+
+void PeriodicCall::
+rmCmd( istringstream& args )
+{
+  stringbuf* pbuf=args.rdbuf();
+  const unsigned int size = pbuf->in_avail();
+  char * buffer = new char [size+1];
+  pbuf->sgetn( buffer,size );
+  buffer[size]='\0';
+  
+  CmdListType::iterator iter = cmdList.begin();
+  while( cmdList.end()!=iter )
+    {
+      const string& str = *iter;
+      if( 0==str.compare( 0,size,buffer ) )
+	{  iter = cmdList.erase( iter );	}
+      else { ++iter; }
+      //cout<<str << " <=> " << buffer << ": " << str.compare( 0,size,buffer )<<endl;
+    }
+	
+  delete buffer;
+  return ;
+}
+
+
+
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+void PeriodicCall::
+runSignals( const int& t )
+{
+  for( SignalMapType::iterator iter = signalMap.begin();
+       signalMap.end()!=iter; ++iter )
+    {
+      (*iter).second ->recompute( t );
+    }
+  return ;
+}
+
+void PeriodicCall::
+runCmds( void )
+{
+  ostringstream onull; onull.clear( ios::failbit );
+
+  for( CmdListType::const_iterator iter = cmdList.begin();
+       cmdList.end()!=iter; ++iter )
+    {
+      istringstream iss( *iter );
+      string cmdName; iss >> cmdName;
+      g_shell.cmd( cmdName,iss,onull );
+    }
+  return ;
+}
+
+  void PeriodicCall::
+run( const int & t )
+{
+  runSignals( t ); runCmds();
+  return ;
+}
+
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+
+void PeriodicCall::
+display( std::ostream& os ) const
+{
+  
+
+  os <<"  (t=" << innerTime << ")" <<endl;
+
+  os<<" -> SIGNALS:"<<endl;
+  for( SignalMapType::const_iterator iter = signalMap.begin();
+       signalMap.end()!=iter; ++iter )
+    {
+      os << " - " << (*iter).first << endl;
+    }
+
+  os<<" -> CMDS:"<<endl;
+  for( CmdListType::const_iterator iter = cmdList.begin();
+       cmdList.end()!=iter; ++iter )
+    {
+      os << " - " <<  (*iter) << endl;
+    }
+
+}
+
+
+
+
+bool PeriodicCall::
+commandLine( const std::string& cmdLine,
+	     std::istringstream& cmdArgs,
+	     std::ostream& os )
+{
+  if( cmdLine == "help" )
+    {
+      os << "PeriodicCall:"<<endl
+	 <<"  - addSignal/rmSignal  <int> " <<endl
+	 <<"  - addCmd/rmCmd  " <<endl
+	 <<"  - runSignal/runCmd " <<endl
+	 <<"  - run" <<endl
+	 <<"  - setTime t " << endl;
+    }
+  else if( cmdLine == "addSignal" )
+    {      addSignal( cmdArgs );    }
+  else if( cmdLine == "rmSignal" )
+    {      rmSignal( cmdArgs );    }
+  else if( cmdLine == "runSignals" )
+    {      runSignals( innerTime++ );    }
+
+  else if( cmdLine == "addCmd" )
+    {      addCmd( cmdArgs );    }
+  else if( cmdLine == "rmCmd" )
+    {      rmCmd( cmdArgs );    }
+  else if( cmdLine == "runCmds" )
+    {      runCmds();    }
+
+  else if( cmdLine == "run" )
+    {      run( innerTime++ );    }
+  else if( cmdLine == "clear" )
+    {     clear();    }
+  else if( cmdLine == "print" ) 
+    { display(os) ; }
+  else { return false; }
+  return true;
+}
+
+
+
+/*
+ * Local variables:
+ * c-basic-offset: 2
+ * End:
+ */
+
diff --git a/src/tools/time-stamp.cpp b/src/tools/time-stamp.cpp
new file mode 100644
index 00000000..9dd5bccd
--- /dev/null
+++ b/src/tools/time-stamp.cpp
@@ -0,0 +1,142 @@
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * Copyright Projet JRL-Japan, 2007
+ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ * File:      TimeStamp.cpp
+ * Project:   SOT
+ * Author:    Paul Evrard
+ *
+ * Version control
+ * ===============
+ *
+ *  $Id$
+ *
+ * Description
+ * ============
+ *
+ *
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+
+/* --------------------------------------------------------------------- */
+/* --- INCLUDE --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+/* SOT */
+#include <sot-core/time-stamp.h>
+#include <sot-core/matrix-homogeneous.h>
+#include <dynamic-graph/factory.h>
+#include <sot-core/macros-signal.h>
+
+/* --------------------------------------------------------------------- */
+/* --- CLASS ----------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+using namespace dynamicgraph;
+using namespace sot;
+
+DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(TimeStamp,"TimeStamp");
+
+
+/* --- CONSTRUCTION ---------------------------------------------------- */
+TimeStamp::
+TimeStamp( const std::string& name )
+  :Entity(name)
+   ,offsetValue( 0 ),offsetSet(false)
+    ,timeSOUT( "TimeStamp("+name+")::output(vector2)::time" )
+   ,timeDoubleSOUT( "TimeStamp("+name+")::output(double)::timeDouble" )
+   ,timeOnceSOUT( boost::bind(&TimeStamp::getTimeStamp,this,_1,_2),
+		  sotNOSIGNAL,
+		  "TimeStamp("+name+")::output(vector2)::synchro" )
+   ,timeOnceDoubleSOUT(  boost::bind(&TimeStamp::getTimeStampDouble,this,
+				     SOT_CALL_SIG(timeSOUT,ml::Vector),_1),
+			 timeSOUT,
+			"TimeStamp("+name+")::output(double)::synchroDouble" )
+{
+  sotDEBUGIN(15);
+  
+  timeSOUT.setFunction( boost::bind(&TimeStamp::getTimeStamp,this,_1,_2) );
+  timeDoubleSOUT.setFunction( boost::bind(&TimeStamp::getTimeStampDouble,this,
+ 					  SOT_CALL_SIG(timeSOUT,ml::Vector),_1) );
+  timeOnceSOUT.setNeedUpdateFromAllChildren( true );
+  timeOnceDoubleSOUT.setNeedUpdateFromAllChildren( true );
+  signalRegistration( timeSOUT << timeDoubleSOUT 
+		      << timeOnceSOUT << timeOnceDoubleSOUT );
+
+  gettimeofday( &val,NULL );
+
+  sotDEBUGOUT(15);
+}
+
+/* --- DISPLAY --------------------------------------------------------- */
+void TimeStamp::
+display( std::ostream& os ) const
+{
+  os << "TimeStamp <> : " << val.tv_sec << "s; "
+     << val.tv_usec << "us." << std::endl;
+}
+
+/* --------------------------------------------------------------------- */
+/* --- CONTROL --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+ml::Vector& TimeStamp::
+getTimeStamp( ml::Vector& res,const int& time )
+{ 
+  sotDEBUGIN(15);
+  gettimeofday( &val,NULL );
+  if( res.size()!=2 ) res.resize(2);
+  
+
+    res(0) = val.tv_sec;
+  res(1) = val.tv_usec;
+  sotDEBUGOUT(15);
+  return res;
+}
+
+double& TimeStamp::
+getTimeStampDouble( const ml::Vector& vect,double& res )
+{ 
+  sotDEBUGIN(15);
+
+  if( offsetSet ) res = (vect(0)-offsetValue)*1000;
+    else res = vect(0)*1000;
+  res += vect(1)/1000;
+  sotDEBUGOUT(15);
+  return res;
+}
+
+
+void TimeStamp::
+commandLine( const std::string& cmdLine,
+	     std::istringstream& cmdArgs,
+	     std::ostream& os )
+{
+  if( cmdLine=="help" )
+    {
+      os << "TimeStamp: "<<std::endl
+	 << " - offset [{<value>|now}] : set/get the offset for double sig." << std::endl;      
+      Entity::commandLine( cmdLine,cmdArgs,os );
+    }
+  else if( cmdLine=="offset" )
+    {
+      cmdArgs >> std::ws; 
+      if( cmdArgs.good() )
+	{ 
+	  std::string offnow; 
+	  cmdArgs >> offnow;  
+	  if(offnow=="now") 
+	    {
+	      gettimeofday( &val,NULL );
+	      offsetValue = val.tv_sec;
+	    }
+	  else { offsetValue = atoi(offnow.c_str()); }
+	  offsetSet = ( offsetValue>0 );
+	} else {
+	  os << "offset = " << (offsetSet ? offsetValue : 0) << std::endl;
+	} 
+    }
+  else { Entity::commandLine( cmdLine,cmdArgs,os ); }
+}
+
+
diff --git a/src/tools/timer.cpp b/src/tools/timer.cpp
new file mode 100644
index 00000000..2e4e23ba
--- /dev/null
+++ b/src/tools/timer.cpp
@@ -0,0 +1,103 @@
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ * Copyright Projet JRL-Japan, 2007
+ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ * File:      Timer.cpp
+ * Project:   SOT
+ * Author:    Nicolas Mansard
+ *
+ * Version control
+ * ===============
+ *
+ *  $Id$
+ *
+ * Description
+ * ============
+ *
+ *
+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+
+/* --------------------------------------------------------------------- */
+/* --- INCLUDE --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+/* SOT */
+#include <sot-core/timer.h>
+#include <MatrixAbstractLayer/boost.h>
+#include <sot-core/matrix-homogeneous.h>
+#include <sot-core/factory.h>
+
+using namespace sot;
+using namespace dynamicgraph;
+
+/* --------------------------------------------------------------------- */
+/* --- CLASS ----------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+typedef Timer<maal::boost::Vector> timevect;
+template <> 
+DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(timevect,"Timer<Vector>");
+
+typedef Timer<maal::boost::Matrix> timematrix;
+template <> 
+DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(timematrix,"Timer<Matrix>");
+
+typedef Timer<MatrixHomogeneous> timematrixhomo;
+template <> 
+DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(timematrixhomo,"Timer<MatrixHomo>");
+
+typedef Timer<double> timedouble;
+template <> 
+DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(timedouble,"Timer<double>");
+
+
+/* --------------------------------------------------------------------- */
+void 
+cmdChrono( const std::string& cmdLine,
+	   std::istringstream& cmdArg,
+	   std::ostream& os )
+{
+  sotDEBUGIN(15);
+
+  if( cmdLine == "help" ) 
+    {
+      os << "  - chrono <cmd...>"
+	 << "\t\t\t\tLaunch <cmd> and display the time spent in the operation." <<std::endl;
+      return;
+    }
+  
+  struct timeval t0,t1;
+  double dt;
+
+  gettimeofday(&t0,NULL);
+  sotDEBUG(15) << "t0: "<< t0.tv_sec << " - " << t0.tv_usec << std::endl;
+  
+  std::string cmdLine2;  cmdArg>>cmdLine2;
+  sotDEBUG(5)<<"Chrono <" <<cmdLine2<<">"<<std::endl;
+  g_shell.cmd(cmdLine2,cmdArg,os);
+
+  gettimeofday(&t1,NULL);
+  dt = ( (t1.tv_sec-t0.tv_sec) * 1000. 
+	 + (t1.tv_usec-t0.tv_usec+0.) / 1000. );
+  sotDEBUG(15) << "t1: "<< t1.tv_sec << " - " << t1.tv_usec << std::endl;
+
+  os << "Time spent = " << dt << " ms " << std::endl;
+
+  sotDEBUGOUT(15);
+}
+
+
+
+extern "C" {
+  ShellFunctionRegisterer regTimer1
+  ( "chrono",boost::bind(cmdChrono,_1,_2,_3) );
+}
+
+
+/* --------------------------------------------------------------------- */
+/* --- CONTROL --------------------------------------------------------- */
+/* --------------------------------------------------------------------- */
+
+
+
diff --git a/src/tools/utils-windows.cpp b/src/tools/utils-windows.cpp
new file mode 100644
index 00000000..09696262
--- /dev/null
+++ b/src/tools/utils-windows.cpp
@@ -0,0 +1,46 @@
+#ifdef WIN32
+#include <sot-core/utils-windows.h>
+
+#include < Windows.h >
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
+#else
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
+#endif
+
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+	FILETIME ft;
+	unsigned __int64 tmpres = 0;
+	static int tzflag;
+
+	if (NULL != tv)
+	{
+		GetSystemTimeAsFileTime(&ft);
+
+		tmpres |= ft.dwHighDateTime;
+		tmpres <<= 32;
+		tmpres |= ft.dwLowDateTime;
+
+		/*converting file time to unix epoch*/
+		tmpres /= 10;  /*convert into microseconds*/
+		tmpres -= DELTA_EPOCH_IN_MICROSECS; 
+		tv->tv_sec = (long)(tmpres / 1000000UL);
+		tv->tv_usec = (long)(tmpres % 1000000UL);
+	}
+
+	if (NULL != tz)
+	{
+		if (!tzflag)
+		{
+			_tzset();
+			tzflag++;
+		}
+		tz->tz_minuteswest = _timezone / 60;
+		tz->tz_dsttime = _daylight;
+	}
+
+	return 0;
+}
+
+#endif /*WIN32*/
-- 
GitLab