Time problems

Hi, I’m coding for my ROSbot in husarioncloud and I want to take two values of time, but i can’t doing because the compiler bring me this error.

using stable distribution

Not searching for unused variables given on the command line.
– The ASM compiler identification is GNU
– Found assembler: /usr/bin/arm-none-eabi-gcc
– Configuring done
– Generating done
– Build files have been written to: build_dir
Scanning dependencies of target main.elf
[100%] Building CXX object CMakeFiles/main.elf.dir/main.cpp.o
Linking CXX executable main.elf
/usr/lib/gcc/arm-none-eabi/4.8/…/…/…/arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-timesr.o): In function _times_r': /home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv7e-m/fpu/newlib/libc/reent/../../../../../../../newlib/libc/reent/timesr.c:60: undefined reference to _times’
collect2: error: ld returned 1 exit status
CMakeFiles/main.elf.dir/build.make:85: recipe for target ‘main.elf’ failed
make[3]: *** [main.elf] Error 1
CMakeFiles/Makefile2:188: recipe for target ‘CMakeFiles/main.elf.dir/all’ failed
make[2]: *** [CMakeFiles/main.elf.dir/all] Error 2
CMakeFiles/Makefile2:235: recipe for target ‘CMakeFiles/main.hex.dir/rule’ failed
make[1]: *** [CMakeFiles/main.hex.dir/rule] Error 2
Makefile:175: recipe for target ‘main.hex’ failed
make: *** [main.hex] Error 2

I’m using

#include <time.h>

clock_t lastTwistTime;



Hello Diego,

In hFramework you can use “sys.getRefTime()” function to get system time in milliseconds.

Example use could be:

#include "hFramework.h"
using namespace hFramework;
uint32_t lastTwistTime;
void hMain()
	while (true)
	    lastTwistTime = sys.getRefTime();


Thank you, i found problems with some functions from ros, like ros::Time:now(). I don’t know if it’s a problem of husarion cloud or mine. Now i’m trying work offline with hFramework,h an ros directly and looks well.

I’m glad hear that you can work now without problems.
In case of any further questions, please don’t hesitate to contact us again.