equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
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 rv = 1000 * (jlong)sb.st_mtime; |
232 #ifndef MACOSX |
|
233 rv = (jlong)sb.st_mtim.tv_sec * 1000; |
|
234 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 |
233 } |
239 } |
234 } END_PLATFORM_STRING(env, path); |
240 } END_PLATFORM_STRING(env, path); |
235 return rv; |
241 return rv; |
236 } |
242 } |
237 |
243 |
411 |
417 |
412 if (stat64(path, &sb) == 0) { |
418 if (stat64(path, &sb) == 0) { |
413 struct timeval tv[2]; |
419 struct timeval tv[2]; |
414 |
420 |
415 /* Preserve access time */ |
421 /* Preserve access time */ |
416 tv[0].tv_sec = sb.st_atime; |
422 #ifndef MACOSX |
417 tv[0].tv_usec = 0; |
423 tv[0].tv_sec = sb.st_atim.tv_sec; |
|
424 tv[0].tv_usec = sb.st_atim.tv_nsec / 1000; |
|
425 #else |
|
426 tv[0].tv_sec = sb.st_atimespec.tv_sec; |
|
427 tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000; |
|
428 #endif |
418 |
429 |
419 /* Change last-modified time */ |
430 /* Change last-modified time */ |
420 tv[1].tv_sec = time / 1000; |
431 tv[1].tv_sec = time / 1000; |
421 tv[1].tv_usec = (time % 1000) * 1000; |
432 tv[1].tv_usec = (time % 1000) * 1000; |
422 |
433 |