Porting float and double variable in linux kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

 

I am currently doing porting work from CAVIUM based code to linux 2.6 kernel. As per my requirement I have to port the below piece of code to linux 2.6.9

 

----------------------------------------

void NHNPGetNTPTime(struct timeval strTv, unsigned long *ntpLsw, unsigned long *ntpMsw)

{

    #ifdef CAVIUM

    double dLsw;

            *ntpMsw = htonl (((unsigned long)strTv.tv_sec + (unsigned long)NHNP_RTP_NTPTIMEOFFSET));  //2208992400UL

            dLsw = (double)strTv.tv_usec / 1000000 * 65536 * 65536;

            *ntpLsw = htonl ((unsigned long) dLsw);

    #else

            // TBD

/* Here we have to write code that will work for Linux 2.6 kernel. */

 

    #endif

}

----------------------------------------

My main objective is how to convert the line” dLsw = (double)strTv.tv_usec / 1000000 * 65536 * 65536”  , so that I will get the accurate NTPTime.

I will appreciate if I get help on this regard. Please provide some info on it.

 

 

Regards,

Jitendra


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux