Просмотр исходного кода

HADOOP-4280. Fix conversions between seconds in C and milliseconds in
Java for access times for files. (Pete Wyckoff via rangadi)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@699417 13f79535-47bb-0310-9956-ffa450edef68

Raghu Angadi 16 лет назад
Родитель
Сommit
bacc3bab17
2 измененных файлов с 7 добавлено и 4 удалено
  1. 3 0
      CHANGES.txt
  2. 4 4
      src/c++/libhdfs/hdfs.c

+ 3 - 0
CHANGES.txt

@@ -734,6 +734,9 @@ Release 0.19.0 - Unreleased
     into the old name and deprecating it. Also update the tests to test the 
     new class. (cdouglas via omalley)
 
+    HADOOP-4280. Fix conversions between seconds in C and milliseconds in 
+    Java for access times for files. (Pete Wyckoff via rangadi)
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

+ 4 - 4
src/c++/libhdfs/hdfs.c

@@ -1469,8 +1469,8 @@ int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime)
       return -2;
     }
 
-    jlong jmtime = mtime * 1000;
-    jlong jatime = atime * 1000;
+    jlong jmtime = mtime * (jlong)1000;
+    jlong jatime = atime * (jlong)1000;
 
     int ret = 0;
     jthrowable jExc = NULL;
@@ -1775,7 +1775,7 @@ getFileInfoFromStat(JNIEnv *env, jobject jStat, hdfsFileInfo *fileInfo)
                                    "FileStatus::getModificationTime");
         return -1;
     }
-    fileInfo->mLastMod = (tTime) (jVal.j) / 1000;
+    fileInfo->mLastMod = (tTime) (jVal.j / 1000);
 
     if (invokeMethod(env, &jVal, &jExc, INSTANCE, jStat,
                      HADOOP_STAT, "getAccessTime", "()J") != 0) {
@@ -1783,7 +1783,7 @@ getFileInfoFromStat(JNIEnv *env, jobject jStat, hdfsFileInfo *fileInfo)
                                    "FileStatus::getAccessTime");
         return -1;
     }
-    fileInfo->mLastAccess = (tTime) (jVal.j) / 1000;
+    fileInfo->mLastAccess = (tTime) (jVal.j / 1000);
 
 
     if (fileInfo->mKind == kObjectKindFile) {