소스 검색

2008-10-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Fixed the bug in Time::elapsed(): Util::difftvsec() is used where
	Util::difftv() should be used instead.
	* src/TimeA2.cc
	* src/TimeA2.h
Tatsuhiro Tsujikawa 17 년 전
부모
커밋
4305a51dd0
3개의 변경된 파일16개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 0
      ChangeLog
  2. 5 2
      src/TimeA2.cc
  3. 4 1
      src/TimeA2.h

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-10-05  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Fixed the bug in Time::elapsed(): Util::difftvsec() is used where
+	Util::difftv() should be used instead.
+	* src/TimeA2.cc
+	* src/TimeA2.h
+
 2008-10-05  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Made socket for dht connections non-blocking

+ 5 - 2
src/TimeA2.cc

@@ -34,9 +34,11 @@
 /* copyright --> */
 
 #include "TimeA2.h"
+
+#include <cstring>
+
 #include "Util.h"
 #include "array_fun.h"
-#include <cstring>
 
 namespace aria2 {
 
@@ -90,7 +92,8 @@ bool Time::elapsed(time_t sec) const {
   if(tv.tv_sec+sec < now) {
     return true;
   } else if(tv.tv_sec+sec == now) {
-    return Util::difftvsec(getCurrentTime(), tv) >= sec;
+    return
+      Util::difftv(getCurrentTime(), tv) >= static_cast<int64_t>(sec)*1000000;
   } else {
     return false;
   }

+ 4 - 1
src/TimeA2.h

@@ -36,10 +36,13 @@
 #define _D_TIME_H_
 
 #include "common.h"
-#include "a2time.h"
+
 #include <stdint.h>
+
 #include <string>
 
+#include "a2time.h"
+
 namespace aria2 {
 
 class Time {