Archived
This forum has been archived. Please start a new discussion on GitHub.
returned value of IceUtil::Time::now()
yongsheng
in Help Center
Hey-
I hope to verify the unit of the returned value of IceUtil::Time::now(). From P.753 of manual "Ice-3.1.1.pdf", the returned value is a double, I think.
My question: Which unit is this value for, seconds or milliseconds or else?
Thanks!
Yongsheng
I hope to verify the unit of the returned value of IceUtil::Time::now(). From P.753 of manual "Ice-3.1.1.pdf", the returned value is a double, I think.
My question: Which unit is this value for, seconds or milliseconds or else?
Thanks!
Yongsheng
0
Comments
-
Hi Marc,
Here are a few lines in the file Ice-3.1.1/demo/Ice/throughput/Client.cpp :
tm = IceUtil::Time::now() - tm;
cout << "time for " << repetitions << " sequences: " << tm * 1000 << "ms" << endl;
cout << "time per sequence: " << tm * 1000 / repetitions << "ms" << endl;
The .toXXX wasn't used in the lline "tm = IceUtil::Time::now() - tm;" so I wonder whether tm is in seconds.
But from tm * 1000 << "ms" in next line, I suppose tm was in seconds. Just want to make sure because I am quoting these lines in my coding work.
Thanks!
Yongsheng0 -
Hi,
The tm variable is an IceUtil::Time which can be converted to any units you like with the toXXX methods. As you discovered, the output of an IceUtil::Time on a [noparse]std::ostream[/noparse] is in seconds, that's why the tm variable is multiplied by 1000 first before printing it on cout in the throughput demo.
Cheers,
Benoit.0
