Add support for millisecond resolution to get/setLastModifiedTime

in both Java IO and NIO.
This commit is contained in:
Alex Dupre
2018-12-27 09:46:44 +00:00
parent be547fb0bb
commit 848047809f
3 changed files with 35 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
PORTNAME= openjdk
PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//}
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= java devel
MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${DIST_BUILD_NUMBER}/:jdk \
https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \

View File

@@ -0,0 +1,23 @@
--- jdk/src/solaris/native/java/io/UnixFileSystem_md.c.orig 2018-12-12 23:07:51.229721000 +0100
+++ jdk/src/solaris/native/java/io/UnixFileSystem_md.c 2018-12-12 23:12:21.847169000 +0100
@@ -208,7 +208,8 @@
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
struct stat64 sb;
if (stat64(path, &sb) == 0) {
- rv = 1000 * (jlong)sb.st_mtime;
+ rv = (jlong)sb.st_mtim.tv_sec * 1000;
+ rv += (jlong)sb.st_mtim.tv_nsec / 1000000;
}
} END_PLATFORM_STRING(env, path);
return rv;
@@ -392,8 +393,8 @@
struct timeval tv[2];
/* Preserve access time */
- tv[0].tv_sec = sb.st_atime;
- tv[0].tv_usec = 0;
+ tv[0].tv_sec = sb.st_atim.tv_sec;
+ tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
/* Change last-modified time */
tv[1].tv_sec = time / 1000;

View File

@@ -0,0 +1,11 @@
--- ./jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c.orig 2018-12-13 10:02:37.501082000 +0100
+++ ./jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c 2018-12-13 10:06:26.825382000 +0100
@@ -453,7 +453,7 @@
(*env)->SetLongField(env, attrs, attrs_st_birthtime_sec, (jlong)buf->st_birthtime);
#endif
-#if (_POSIX_C_SOURCE >= 200809L) || defined(__solaris__)
+#if (_POSIX_C_SOURCE >= 200809L) || defined(__solaris__) || defined(__FreeBSD__)
(*env)->SetLongField(env, attrs, attrs_st_atime_nsec, (jlong)buf->st_atim.tv_nsec);
(*env)->SetLongField(env, attrs, attrs_st_mtime_nsec, (jlong)buf->st_mtim.tv_nsec);
(*env)->SetLongField(env, attrs, attrs_st_ctime_nsec, (jlong)buf->st_ctim.tv_nsec);