Re: g_timer_elapsed
- From: Mikael Hallendal <micke codefactory se>
- To: Paulo Jorge de Oliveira Cantante de Matos <pdestroy netcabo pt>
- Cc: GTK+ Mailing List App Devel <gtk-app-devel-list gnome org>
- Subject: Re: g_timer_elapsed
- Date: 05 May 2001 15:24:59 +0200
Hi!
You are trying to print a double as an int (change %d to %f in your
printout, this will make the print look better).
Regards,
Mikael Hallendal
Den 05 May 2001 13:21:27 +0100 skrev Paulo Jorge de Oliveira Cantante de Matos:
Hi,
Pls check this code and its result:
Code:
#include <stdio.h>
#include <gtk\gtk.h>
int main(void) {
GTimer *mytime;
unsigned long msecs;
double secs;
unsigned long soma=1000;
g_timer_reset(mytime);
g_timer_start(mytime);
for(;soma>0;soma--) g_print("duh");
secs = g_timer_elapsed(mytime, &msecs);
g_print("\n\n%d secs, %lu msecs", secs, msecs);
return 0;
}
Result: ("duh" repeated 1000 times and...)
-927712936 secs, 1071103606 msecs
What kind of result is this?
Negative seconds??? As far as I can read in the manual:
gdouble g_timer_elapsed (GTimer *timer,
gulong *microseconds);
timer :
the timer.
microseconds :
if non-NULL, this will be set to the
microseconds component of the elapsed time (it does not include the
number of seconds
elapsed).
Returns :
the elapsed time in seconds, as a double.
It seems that it is not working. What's the problem?
Best regards,
--
+------------------Paulo J. Matos aka PDestroy--------------------+
| ICQ # 361853 | http://www.pdestroy.net | pdestroy netcabo pt |
| http://iascp.sourceforge.net | http://mega.ist.utl.pt/~pocm |
| "Fixed width font LIVEZ!" | "Portability came to rule!" |
+-----------------------------------------------------------------+
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
+------------------------------------------
| email : micke hallendal net
| sms : micke mobil hallendal net
| homepage : http://micke.hallendal.net/
| PGP-key : micke.hallendal.net/mikhal.gpg
+------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]