Results 1 to 3 of 3

Thread: Using IceUtil::Time in a Slice definition

  1. #1
    sidney is offline Registered User
    Name: Sidney Cadot
    Organization: TNO, Netherlands
    Project: sonar processing software
    Join Date
    Mar 2010
    Posts
    26

    Using IceUtil::Time in a Slice definition

    Hi all,

    I am trying to design an interface that needs to transfer high-precision time information as parameters and/or return values, and the IceUtil::Time would be quite suitable for this purpose. I have two questions:

    (1) Is this a good idea? The type is defined in the "C++ utility" part of the manual, and I can only assume that it's not available from other languages.

    (2) If I wanted to use the IceUtil::Time type, how would I do it, i.e., what would be the proper way to include the "IceUtil" module declaration into my ice file?

    Best regards, Sidney

  2. #2
    mes's Avatar
    mes
    mes is online now ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,424
    Hi Sidney,

    It's not possible to include language-specific types in your Slice definitions. Instead, you will need to define an equivalent type in Slice. It's possible that Slice's long type (a signed 64-bit integer) would be sufficient for your purposes, and the IceUtil::Time class provides static methods that convert long values into IceUtil::Time objects.

    For example:
    Code:
    Ice::Long v = someProxy->getTime(); // get time in milliseconds
    IceUtil::Time t = IceUtil::Time::milliSeconds(v);
    Of course, if these time values will be used in multiple programming languages, you'll have to ensure that you handle them portably (i.e., use the same epoch across all languages, or convert the values when necessary, and so on).

    Hope that helps,
    Mark

  3. #3
    sidney is offline Registered User
    Name: Sidney Cadot
    Organization: TNO, Netherlands
    Project: sonar processing software
    Join Date
    Mar 2010
    Posts
    26
    Ok, that's clear -- I'll define my own high-resolution time type, then.

    Thanks, Sidney

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. slice definition if dfstream file
    By moshehak in forum Help Center
    Replies: 1
    Last Post: 02-21-2008, 08:47 AM
  2. slice definition for type ID?
    By peterlspot in forum Comments
    Replies: 5
    Last Post: 11-28-2007, 11:13 PM
  3. returned value of IceUtil::Time::now()
    By yongsheng in forum Help Center
    Replies: 4
    Last Post: 03-09-2007, 04:07 AM
  4. IceUtil::Time documentation
    By n2503v in forum Bug Reports
    Replies: 1
    Last Post: 10-23-2005, 06:03 PM
  5. Zero value for IceUtil::Time
    By catalin in forum Help Center
    Replies: 1
    Last Post: 10-05-2004, 08:28 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
  •