3snowp7im / urn

Split tracker / timer with GTK+ frontend
GNU General Public License v3.0
125 stars 36 forks source link

Times overflow on 32-bit systems #4

Closed glacials closed 9 years ago

glacials commented 9 years ago

When compiling Urn on my 32-bit system I get the following warning (though compilation is successful):

$ make
cc `pkg-config --cflags gtk+-3.0 x11 jansson`   -c -o urn-gtk.o urn-gtk.c
cc `pkg-config --cflags gtk+-3.0 x11 jansson`   -c -o urn.o urn.c
urn.c: In function 'urn_time_string_format':
urn.c:64:35: warning: integer overflow in expression [-Woverflow]
     hours = time / (1000000L * 60 * 60);
                                   ^
cc `pkg-config --cflags gtk+-3.0 x11 jansson`   -c -o bind.o bind.c
cc   urn-gtk.o urn.o bind.o  `pkg-config --libs gtk+-3.0 x11 jansson` -o urn-gtk

Running that executable and entering a run, if you let the timer tick over 0:11:34 the time overflows to -1:11:34. If you get past this point and continue the run, negative times and best_times get written to the splits file.

deffi420 commented 9 years ago

Fixed.