This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> This is okay with me, but please use 1000000L rather than just 1000000 > here: > > > + tv->utime.tv_usec = usec - 1000000*tv->utime.tv_sec; > > and here: > > > + static long > > + timeval_diff (struct timeval start, struct timeval end) > > + { > > + return ((end.tv_sec - start.tv_sec) * 1000000) > > + + (end.tv_usec - start.tv_usec); > > + } > > This is to avoid a possible overflow of a 32-bit int on systems where > tv_sec is a 32-bit type. I was so immersed in trying to commit my changes correctly that I missed this so I had to do it retrospectively. > Other than that, this patch can go in, but please show here the exact > patch you commit, since you didn't show it in the message to which I'm > replying. I am sending it as an attachment with your change listed separately. Maybe I've made mistakes (I've not made changes to configury before) but I'll be available to correct it if necessary. Thanks for your help. -- Nick http://www.inet.net.nz/~nickrob *** mi-main.c 03 Feb 2007 11:31:46 +1300 1.92 --- mi-main.c 03 Feb 2007 12:17:14 +1300 *************** mi_load_progress (const char *section_na *** 1461,1467 **** if (delta.tv_usec < 0) { delta.tv_sec -= 1; ! delta.tv_usec += 1000000; } new_section = (previous_sect_name ? --- 1461,1467 ---- if (delta.tv_usec < 0) { delta.tv_sec -= 1; ! delta.tv_usec += 1000000L; } new_section = (previous_sect_name ? *************** timestamp (struct mi_timestamp *tv) *** 1537,1544 **** tv->stime.tv_usec = rusage.ru_stime.tv_usec; #else usec = get_run_time (); ! tv->utime.tv_sec = usec/1000000; ! tv->utime.tv_usec = usec - 1000000*tv->utime.tv_sec; tv->stime.tv_sec = 0; tv->stime.tv_usec = 0; #endif --- 1537,1544 ---- tv->stime.tv_usec = rusage.ru_stime.tv_usec; #else usec = get_run_time (); ! tv->utime.tv_sec = usec/1000000L; ! tv->utime.tv_usec = usec - 1000000L*tv->utime.tv_sec; tv->stime.tv_sec = 0; tv->stime.tv_usec = 0; #endif *************** print_diff_now (struct mi_timestamp *sta *** 1555,1561 **** static long timeval_diff (struct timeval start, struct timeval end) { ! return ((end.tv_sec - start.tv_sec) * 1000000) + (end.tv_usec - start.tv_usec); } --- 1555,1561 ---- static long timeval_diff (struct timeval start, struct timeval end) { ! return ((end.tv_sec - start.tv_sec) * 1000000L) + (end.tv_usec - start.tv_usec); }
Attachment:
final_timing.diff
Description: timing patch
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |