Hi,

the following code works, so maybe you just didn't add it in the right place?

#include <sys/time.h>
#include <stdio.h>

int main (void) {
   int i;
   struct timeval tv;
   for (i=0; i < 500; i++) {
       gettimeofday(&tv, NULL);
printf("Current time is %ld sec and %ld usec\n", tv.tv_sec, tv.tv_usec);
   }
   return(0);
}

--
Wolfram


Mikhail Ramendik wrote:

Hello,

Well, this is really not a dbmail question, but as I need it to try and
speed up dbmail, I hope you'll bear with me.

I am trying to understand why _ic_fetch() is slow. For this I need log
entries with millisecond, not second, precision. Apparently syslogd
can't do this, so I tried to add the following to the trace function in
debug.c :

               struct timeval _tv;
               struct timezone _tz;

               gettimeofday(&_tv,&_tz);
               vsyslog(LOG_NOTICE,"Microseconds: %d", _tv.tv_usec);

(Of course I also added #include<sys/time.h> in the beginning).

This causes a segfault. Why? And what is the right way of getting any
system time value in milli-or microseconds? (I don't care if it wraps
every second or not).

Yours, Mikhail Ramendik




_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to