getTime
Note: |
All examples here use dcm.getTime() to get all time for timed-command request. This is just an example, and there are better ways to use it. For example, you can just do one dcm.getTime() at startup and after increment the integer value for each ms. Or you can use the CPU clock if you have a module running on the robot. |
---|
Return the absolute time used for all timed command in the DCM, with a number of ms to add or remove to this time.
This time returned is an integer (signed), with 1 ms precision. Be careful: it can roll-over.
/** * Return the DCM time * * @param time pParams has the optional time in ms (signed) to add/remove * * @return An integer (could be signed) with the DCM time * */ int DCM::getTime(int pTime)
Python example
import naoqi from naoqi import ALProxy dcm = ALProxy("DCM","127.0.0.1",9559) print dcm.getTime(10000)
Returns the absolute time in 10s.
import naoqi from naoqi import ALProxy dcm = ALProxy("DCM","127.0.0.1",9559) print dcm.getTime(0)
Returns the current time (more the communication delay).
C++ example
// Program running in a module. Do not forget the #include "dcmproxy.h" try { DCMProxy* dcm = new DCMProxy(pBroker); int time = dcm->getTime(10000); cout << time << endl; } AL_CATCH_ERR(return false;);
Returns the absolute time in 10s.
// Program running in a module. Do not forget the #include "dcmproxy.h" try { DCMProxy* dcm = new DCMProxy(pBroker); int time = dcm->getTime(0); cout << time << endl; } AL_CATCH_ERR(return false;);
Returns the current time (more the communication delay).