This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

About IPNC source of timestamp!

Hi All: In the program of IPNC csl_sysLiinuxDrv.c(framework/csl/kermod/src/system), I find the function:

Uint32 CSL_sysGetCurTime()

{

     struct timeval tv;

      do_gettimeofday(&tv);

     return (tv.tv_sec*1000) + (tv.tv_usec + 500) / 1000;

}

And the return value of this function is overflow to unsigned int datatype. so I cannot get timestamp correctly in usermod.

I don't understand this function. How can i get timestamp of capture buffer? Thanks very much!

  • Hi Gomo,

    You are right. There is a possibility of overflow that can happen. You might want to change the function and modify it to return 64bit value. But you would have to change the usage of this function everywhere in the code calling CSL_sysGetCurTime().

    I will raise an internal bug on this issue and see if we can fix in later releases of IPNC.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Yes, I got the same problem , any solutions ?

  • //modify by gomo 2010-08-18
    #if 0
    Uint32 CSL_sysGetCurTime()
    {
      struct timeval tv;

      do_gettimeofday(&tv);

      return (tv.tv_sec * 1000) + (tv.tv_usec + 500) / 1000;
    }
    #else
    Uint32 CSL_sysGetCurTime(int *timestamp, int *timeusec)
    {
      struct timeval tv;
      do_gettimeofday(&tv);
      *timestamp = tv.tv_sec;
      *timeusec = tv.tv_usec;
      return 0;
    }
    #endif

    And then modify all related places. and you can modify it to return 64bit value, it's simple than my way.