Thread: How to convert this into a meaningful timestamp

  1. #1
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838

    How to convert this into a meaningful timestamp

    the documentation for this particular piece of equipment gives the following:

    Code:
    struct 
    { 
      UINT32  CycleOffset : 12; 
      UINT32  CycleCount  : 13; 
      UINT32  Second      : 7; 
    }BUSTIME; 
     
     
    which is:  
     
    Bit[11..0]  = Cycle Offset in parts of 1/3072 (=24.576 MHz) 
    Bit[24..12] = Cycle Count 
    Bit[31..25] = Second Count
    the author of this documentation is...terse, to say the least.

    my problem is that i need to ensure that the data i am retrieving from it is obtained after the function call is made. typically not a problem, but this has a buffer ring, and even if i drain it completely on each acquisition cycle, sometimes the data is still from the past :\


    the only timestamping information is as follows:

    UINT32[2] RxTime Out Receive time as 100ns ticks since 1.1.1601.
    UINT32 BeginCycleTime Out When frame start events are active this is the bus time when
    the frame start was detected (for bus time see remarks).
    UINT32 EndCycleTime Out This is the bus time when the frame end was detected (for
    bus time see remarks).

    does anyone see a way to obtain the time that the data was actually acquired by the hardware? RxTime connotes to me the time when the data was transferred to me (which is not helpful), as opposed to when it was copied into the equipment's local buffer.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> this has a buffer ring
    http://www.intek-darmstadt.de/FireGrab.pdf
    So it's in "DMA - Replace Mode" then?

    The application can detect "stolen‟ buffers as every image buffer that leaves the "DMA queue‟ is stamped with a unique identifier.
    Is this really what you need to do? That would be FGFRAME.Id if so.

    Based on the manual (which seems to be referring to the IEC-61883 protocol), a packet can be delivered, per channel, every 125µs, or 1/.000125=8000 packets per sec.

    The 13 bits of CycleCount can represent a max value of 8191. But I'm assuming that it will "rollover" at 8000, incrementing the seconds by 1. The CycleOffset rolls over at 3072 (as commented), incrementing the CycleCount by 1. And the seconds roll over after 127.

    I inferred some of this from a few places:
    http://tools.ietf.org/html/draft-iet...-01#appendix-A
    http://msdn.microsoft.com/en-us/library/ms789561.aspx

    Also, I would guess that RxTime does not refer to when the function returned. When the frame was placed in the "Ready-Queue" would make more sense.

    gg

  3. #3
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    So it's in "DMA - Replace Mode" then?
    yes.

    Is this really what you need to do? That would be FGFRAME.Id if so.
    no. i don't care about grabbing every frame. there will be many stolen frames.

    Also, I would guess that RxTime does not refer to when the function returned. When the frame was placed in the "Ready-Queue" would make more sense.
    any guess as to which windows function converts RxTime? the doc says it can be done but doesn't clue you in as to which one is appropriate.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    That's a "FILETIME" value. So you can use functions that take a FILETIME.

    gg

  5. #5
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    thank you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  3. Convert Char to Int Function
    By drdroid in forum C++ Programming
    Replies: 9
    Last Post: 02-19-2003, 12:53 PM
  4. convert integer unix timestamp to time
    By rotis23 in forum C Programming
    Replies: 2
    Last Post: 11-18-2002, 09:20 AM
  5. please help ... to convert date to string
    By mel in forum C Programming
    Replies: 1
    Last Post: 06-12-2002, 10:26 AM