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

Re: [rtl] rt_printk long long output



1. Don't you have to cast the results of the division to int (from long
long) before this will work, i.e.
	rtl_printf( "%d%09d" , (int)(t/100000...... );   ?
2. I also sent a code snippet for a function to format long-long in %16X.


	Norm

At 12:13 AM 8/3/2000 +0400, Michael Barabanov wrote:
>t = gethrtime();
>rtl_printf("%d%09d", t / 1000000000, t % 1000000000);
>
>Michael.
>
>Dresner, Norman A. (norman_a_dresner@md.northgrum.com) wrote:
>> That answer isn't totally true.
>> 
>> I have a driver that's linked with the gcc-library for 64-bit math that's
>> been running successfully for several months. In my RedHat 5.2 distribution
>> with the 2.0.36 kernel, that library is found at
>> 	/usr/lib/gcc-lib/i386-redhat-linux/ecgs-2..0.29/libgcc.a
>> and I am using 64-bit division in the (real-time) driver many times a
>> second.
>> 
>> But I believe that the statement that printk() doesn't support long-long
>> quantities is still true.
>> 
>> 	Norm Dresner
>> 	Fellow Systems Engineer
>> 	Radar Systems Engineering Department
>> 	Electronic Systems and Sensors Segment
>> 	Northrop Grumman Corporation
>> 	MS 520
>> 	Box 746
>> 	Baltimore MD 21203
>> 
>> Voice:	(410) 993 - 2096	Mornings; all-day voice-mail
>> 	(410) 969 - 8068	Afternoons with answering machine
>> FAX:	(410) 993 - 8084	On-site
>> 	(410) 969 - 8068	Afternoons; call first to arrange
>> E-Mail:Mornings:	Norman_A_Dresner@mail.Northgrum.com
>> 	Afternoons:	ndrez@att.net
>> 
>> > -----Original Message-----
>> > From:	kissg@sztaki.hu [SMTP:kissg@sztaki.hu]
>> > Sent:	Monday, July 31, 2000 7:33 AM
>> > To:	dewa@students.if.itb.ac.id
>> > Cc:	rtl@rtlinux.org
>> > Subject:	Re: [rtl] rt_printk long long output
>> > 
>> > > My question is a silly one : how to do rt_printk() of gethrtime()
return
>> > > value. gethrtime() returns 64-bit signed integer (a long long int).
>> > > I already tried %q (quad int), %L, and %ll but they won't work.
>> > 
>> > No more than two months ago we discussed this topic
>> > on the list. Check archive.
>> > 
>> > The answer is: no longlong capability of printk() because
>> > it would require 64 bit division. However your processor has
>> > 32 bit arithmetic only and no math library linked with the kernel.
>> > 
>> > Print the time in hex:
>> > XXXXprint("%.8x%.8x", (long)((time>>32)&0xffffffff),
>> > (long)(time&0xffffffff));
>> > 
>> > Gabor
>> > -- [rtl] ---
>> > To unsubscribe:
>> > echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
>> > echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
>> > ---
>> > For more information on Real-Time Linux see:
>> > http://www.rtlinux.org/rtlinux/
>> -- [rtl] ---
>> To unsubscribe:
>> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
>> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
>> ---
>> For more information on Real-Time Linux see:
>> http://www.rtlinux.org/rtlinux/
>-- [rtl] ---
>To unsubscribe:
>echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
>echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
>---
>For more information on Real-Time Linux see:
>http://www.rtlinux.org/rtlinux/
>
>