* Re: Help: lib function localtime extremely slow
@ 1996-04-04 15:30 David Mosberger-Tang
0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger-Tang @ 1996-04-04 15:30 UTC (permalink / raw)
>>>>> On Thu, 4 Apr 1996 09:00:25 -0600 (CST), (cosc1) 95h02740 <yxc02740@Bayou.UH.EDU> said:
Yansong> I found once that localtime takes about 28 seconds CPU time
Yansong> to run on a 166MHz UDB running redhat Linux. What on earth
Yansong> does the localtime do? sometimes it runs fast, but the
Yansong> time needed is about between 1-30 seconds.
I'm not familiar with the locatime() implementation in the old libc,
but the GNU libc had a function that used an iterative algorithm which
took forever when passed 64 bit values (values that don't fit into 32
bits). That's fixed now in glibc. I seem to remember Bob Manson
mentioning problems similar to what I saw in glibc when he originally
started the libc work. So it wouldn't surprise me if the old libc
uses the same broken algorithm. In any case, if localtime() takes 28
seconds on a 32 bit value, there definitively is something broken (in
case that wasn't clear... :-).
--david
^ permalink raw reply [flat|nested] 2+ messages in thread
* Help: lib function localtime extremely slow
@ 1996-04-04 15:00 yxc02740
0 siblings, 0 replies; 2+ messages in thread
From: yxc02740 @ 1996-04-04 15:00 UTC (permalink / raw)
Hi, guess how long does the function localtime need to run? I tried a
program as following:
#include <time.h>
#include <sys/time.h>
main()
{
struct timeval tv;
struct timezone zone;
struct tm *localclock;
clock_t t0, t1;
gettimeofday(&tv, &zone);
t0 = clock();
localclock = localtime( (time_t *)&tv.tv_sec );
t1 = clock();
printf("time: %.3f\n", (float)(t1-t0)/CLOCKS_PER_SEC);
}
I found once that localtime takes about 28 seconds CPU time to run on a
166MHz UDB running redhat Linux.
What on earth does the localtime do?
sometimes it runs fast, but the time needed is about between 1-30 seconds.
yansong
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-04-04 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-04-04 15:30 Help: lib function localtime extremely slow David Mosberger-Tang
-- strict thread matches above, loose matches on Subject: below --
1996-04-04 15:00 yxc02740
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox