From: yxc02740@Bayou.UH.EDU
Subject: Help: lib function localtime extremely slow
Date: Thu, 4 Apr 1996 09:00:25 -0600 (CST) [thread overview]
Message-ID: <199604041500.JAA23051@Bayou.UH.EDU> (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
next reply other threads:[~1996-04-04 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-04 15:00 yxc02740 [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-04-04 15:30 Help: lib function localtime extremely slow David Mosberger-Tang
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox