Results 1 to 5 of 5

Thread: returned value of IceUtil::Time::now()

  1. #1
    yongsheng is offline Registered User
    Name: Yongsheng Ma
    Organization: Dawning Supercomputing Co.
    Project: cluster
    Join Date
    Feb 2007
    Location
    China
    Posts
    7

    returned value of IceUtil::Time::now()

    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

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    IceUtil::Time::now() returns an instance of the IceUtil::Time class. You can then use the various toXXX methods to get the time as 64-bit integer or as double. For example, toSecondsDouble() gives you the time as a double in seconds.

  3. #3
    yongsheng is offline Registered User
    Name: Yongsheng Ma
    Organization: Dawning Supercomputing Co.
    Project: cluster
    Join Date
    Feb 2007
    Location
    China
    Posts
    7
    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!
    Yongsheng

  4. #4
    yongsheng is offline Registered User
    Name: Yongsheng Ma
    Organization: Dawning Supercomputing Co.
    Project: cluster
    Join Date
    Feb 2007
    Location
    China
    Posts
    7
    OK. I have confirmed that it is in seconds by default.

  5. #5
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    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 std::ostream 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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using IceUtil::Time in a Slice definition
    By sidney in forum Help Center
    Replies: 2
    Last Post: 03-19-2010, 04:33 AM
  2. Replies: 4
    Last Post: 08-19-2009, 01:21 PM
  3. IceUtil::Time documentation
    By n2503v in forum Bug Reports
    Replies: 1
    Last Post: 10-23-2005, 05:03 PM
  4. Zero value for IceUtil::Time
    By catalin in forum Help Center
    Replies: 1
    Last Post: 10-05-2004, 07:28 AM
  5. Crash in IceUtil::Time caused by VC6 bug
    By kssreeram in forum Help Center
    Replies: 3
    Last Post: 04-22-2004, 07:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •