Browse Source

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 years ago
parent
commit
bacc3bab17
2 changed files with 7 additions and 4 deletions
  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 
     into the old name and deprecating it. Also update the tests to test the 
     new class. (cdouglas via omalley)
     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
 Release 0.18.2 - Unreleased
 
 
   BUG FIXES
   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;
       return -2;
     }
     }
 
 
-    jlong jmtime = mtime * 1000;
-    jlong jatime = atime * 1000;
+    jlong jmtime = mtime * (jlong)1000;
+    jlong jatime = atime * (jlong)1000;
 
 
     int ret = 0;
     int ret = 0;
     jthrowable jExc = NULL;
     jthrowable jExc = NULL;
@@ -1775,7 +1775,7 @@ getFileInfoFromStat(JNIEnv *env, jobject jStat, hdfsFileInfo *fileInfo)
                                    "FileStatus::getModificationTime");
                                    "FileStatus::getModificationTime");
         return -1;
         return -1;
     }
     }
-    fileInfo->mLastMod = (tTime) (jVal.j) / 1000;
+    fileInfo->mLastMod = (tTime) (jVal.j / 1000);
 
 
     if (invokeMethod(env, &jVal, &jExc, INSTANCE, jStat,
     if (invokeMethod(env, &jVal, &jExc, INSTANCE, jStat,
                      HADOOP_STAT, "getAccessTime", "()J") != 0) {
                      HADOOP_STAT, "getAccessTime", "()J") != 0) {
@@ -1783,7 +1783,7 @@ getFileInfoFromStat(JNIEnv *env, jobject jStat, hdfsFileInfo *fileInfo)
                                    "FileStatus::getAccessTime");
                                    "FileStatus::getAccessTime");
         return -1;
         return -1;
     }
     }
-    fileInfo->mLastAccess = (tTime) (jVal.j) / 1000;
+    fileInfo->mLastAccess = (tTime) (jVal.j / 1000);
 
 
 
 
     if (fileInfo->mKind == kObjectKindFile) {
     if (fileInfo->mKind == kObjectKindFile) {