jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c
changeset 45297 df90da0c10aa
parent 45178 9ff621041842
equal deleted inserted replaced
45296:ae7b350fabcb 45297:df90da0c10aa
   227     jlong rv = 0;
   227     jlong rv = 0;
   228 
   228 
   229     WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
   229     WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
   230         struct stat64 sb;
   230         struct stat64 sb;
   231         if (stat64(path, &sb) == 0) {
   231         if (stat64(path, &sb) == 0) {
   232 #ifndef MACOSX
   232 #if defined(_AIX)
       
   233             rv =  (jlong)sb.st_mtime * 1000;
       
   234             rv += (jlong)sb.st_mtime_n / 1000000;
       
   235 #elif defined(MACOSX)
       
   236             rv  = (jlong)sb.st_mtimespec.tv_sec * 1000;
       
   237             rv += (jlong)sb.st_mtimespec.tv_nsec / 1000000;
       
   238 #else
   233             rv  = (jlong)sb.st_mtim.tv_sec * 1000;
   239             rv  = (jlong)sb.st_mtim.tv_sec * 1000;
   234             rv += (jlong)sb.st_mtim.tv_nsec / 1000000;
   240             rv += (jlong)sb.st_mtim.tv_nsec / 1000000;
   235 #else
       
   236             rv  = (jlong)sb.st_mtimespec.tv_sec * 1000;
       
   237             rv += (jlong)sb.st_mtimespec.tv_nsec / 1000000;
       
   238 #endif
   241 #endif
   239         }
   242         }
   240     } END_PLATFORM_STRING(env, path);
   243     } END_PLATFORM_STRING(env, path);
   241     return rv;
   244     return rv;
   242 }
   245 }
   417 
   420 
   418         if (stat64(path, &sb) == 0) {
   421         if (stat64(path, &sb) == 0) {
   419             struct timeval tv[2];
   422             struct timeval tv[2];
   420 
   423 
   421             /* Preserve access time */
   424             /* Preserve access time */
   422 #ifndef MACOSX
   425 #if defined(_AIX)
       
   426             tv[0].tv_sec = sb.st_atime;
       
   427             tv[0].tv_usec = sb.st_atime_n / 1000;
       
   428 #elif defined(MACOSX)
       
   429             tv[0].tv_sec = sb.st_atimespec.tv_sec;
       
   430             tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000;
       
   431 #else
   423             tv[0].tv_sec = sb.st_atim.tv_sec;
   432             tv[0].tv_sec = sb.st_atim.tv_sec;
   424             tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
   433             tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
   425 #else
   434 #endif
   426             tv[0].tv_sec = sb.st_atimespec.tv_sec;
       
   427             tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000;
       
   428 #endif
       
   429 
       
   430             /* Change last-modified time */
   435             /* Change last-modified time */
   431             tv[1].tv_sec = time / 1000;
   436             tv[1].tv_sec = time / 1000;
   432             tv[1].tv_usec = (time % 1000) * 1000;
   437             tv[1].tv_usec = (time % 1000) * 1000;
   433 
   438 
   434             if (utimes(path, tv) == 0)
   439             if (utimes(path, tv) == 0)