Top Description Constructors Methods
org.eclipse.jgit.junit.time

public Class TimeUtil

extends Object
Class Inheritance
Imports
java.io.IOException, .UncheckedIOException, java.nio.file.Files, .Path, java.nio.file.attribute.FileTime, java.time.Instant, org.eclipse.jgit.util.FS

Utility methods for handling timestamps
Since
5.1.9

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
setLastModifiedOf(Path
file to set lastModified time
a
,
Path
file to read lastModified time from
b
)

Set the lastModified time of file a to the one from file b

public static Instant

Returns:

the new lastModified time
setLastModifiedWithOffset
(Path
path of a file to set last modified
path
,
long
offset in milliseconds, if negative the new lastModified time is offset before the original lastModified time, otherwise after the original time
offsetMillis
)

Set the lastModified time of a given file by adding a given offset to the current lastModified time

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TimeUtilback to summary
public TimeUtil()

Method Detail

setLastModifiedOfback to summary
public static void setLastModifiedOf(Path a, Path b)

Set the lastModified time of file a to the one from file b

Parameters
a:Path

file to set lastModified time

b:Path

file to read lastModified time from

setLastModifiedWithOffsetback to summary
public static Instant setLastModifiedWithOffset(Path path, long offsetMillis)

Set the lastModified time of a given file by adding a given offset to the current lastModified time

Parameters
path:Path

path of a file to set last modified

offsetMillis:long

offset in milliseconds, if negative the new lastModified time is offset before the original lastModified time, otherwise after the original time

Returns:Instant

the new lastModified time