[xiph-cvs] cvs commit: vorbis-tools/oggenc platform.c

Michael Smith msmith at xiph.org
Sat Jul 6 19:04:45 PDT 2002



msmith      02/07/06 19:04:44

  Modified:    oggenc   platform.c
  Log:
  Don't return time as 0 to avoid division by zero in rate statistics.

Revision  Changes    Path
1.12      +4 -1      vorbis-tools/oggenc/platform.c

Index: platform.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/platform.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- platform.c	2002/07/01 06:41:50	1.11
+++ platform.c	2002/07/07 02:04:44	1.12
@@ -59,7 +59,10 @@
         time_t now = time(NULL);
         time_t start = *((time_t *)timer);
 
-	return (double)(now-start);
+    if(now-start)
+    	return (double)(now-start);
+    else
+        return 1; /* To avoid division by zero later, for very short inputs */
 }
 
 

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list